Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-03-09 09:01:27 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-03-09 09:01:27 (GMT)
commit39b1be762bb99f4f6186001840761d1ef6d0bfa4 (patch)
tree1297d1f550ec5246a95c02f62da550da0048acd5
parent7fa8172ac1d1c8afcd6e7c45600e5932cc4f5799 (diff)
Rename "documents" key in GET response to "result"
-rw-r--r--restful_document/document.py2
-rwxr-xr-xtests/units/document.py12
2 files changed, 7 insertions, 7 deletions
diff --git a/restful_document/document.py b/restful_document/document.py
index 497eeaf..a62c002 100644
--- a/restful_document/document.py
+++ b/restful_document/document.py
@@ -52,7 +52,7 @@ class Document(ad.Document):
documents, total = cls.find(offset, limit, kwargs, query, reply,
order_by)
return {'total': total.value,
- 'documents': [i.all_properties(reply) for i in documents]}
+ 'result': [i.all_properties(reply) for i in documents]}
@restful_method(method='PUT')
def restful_put(self, prop=None):
diff --git a/tests/units/document.py b/tests/units/document.py
index 83fca1d..77a8d4e 100755
--- a/tests/units/document.py
+++ b/tests/units/document.py
@@ -92,7 +92,7 @@ class DocumentTest(tests.Test):
{'guid': guid_1, 'stored': 'stored', 'term': 'term', 'vote': False, 'counter': 0},
{'guid': guid_2, 'stored': 'stored2', 'term': 'term2', 'vote': False, 'counter': 0},
]),
- sorted(reply['documents']))
+ sorted(reply['result']))
rest.put('/document/' + guid_2, payload=json.dumps({
'vote': True,
@@ -117,7 +117,7 @@ class DocumentTest(tests.Test):
self.assertEqual(
{'total': 2,
- 'documents': sorted([
+ 'result': sorted([
{'guid': guid_1, 'stored': 'stored', 'term': 'term', 'vote': False, 'counter': 0},
{'guid': guid_2, 'stored': 'stored3', 'term': 'term3', 'vote': True, 'counter': 1},
])},
@@ -130,7 +130,7 @@ class DocumentTest(tests.Test):
self.assertEqual(
{'total': 1,
- 'documents': sorted([
+ 'result': sorted([
{'guid': guid_2, 'stored': 'stored3', 'term': 'term3', 'vote': True, 'counter': 1},
])},
json.loads(rest.get('/document', reply='guid,stored,term,vote,counter').body_string()))
@@ -156,7 +156,7 @@ class DocumentTest(tests.Test):
self.assertEqual(
{'total': 0,
- 'documents': sorted([])},
+ 'result': sorted([])},
json.loads(rest.get('/document', reply='guid,stored,term,vote,counter').body_string()))
def test_ServerCrash(self):
@@ -184,7 +184,7 @@ class DocumentTest(tests.Test):
sorted([{'guid': guid_1, 'stored': 'stored', 'term': 'term', 'vote': False},
{'guid': guid_2, 'stored': 'stored2', 'term': 'term2', 'vote': True},
]),
- sorted(reply['documents']))
+ sorted(reply['result']))
self.httpdown(8000)
self.httpd(8001, [Document])
@@ -196,7 +196,7 @@ class DocumentTest(tests.Test):
sorted([{'guid': guid_1, 'stored': 'stored', 'term': 'term', 'vote': False, 'counter': 0},
{'guid': guid_2, 'stored': 'stored2', 'term': 'term2', 'vote': True, 'counter': 1},
]),
- sorted(reply['documents']))
+ sorted(reply['result']))
if __name__ == '__main__':