Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/units/volume.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-10-03 17:22:53 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-10-03 17:22:53 (GMT)
commit7d254fa3bfb796543092b1cec9ca35c2838110e0 (patch)
treeab5e64ae213480ec009b432ed0516f34aca91d13 /tests/units/volume.py
parentcd748b46fbf50818a552d161ace57e26848e6de2 (diff)
Do not include "guid" to find() reply to make group_by useful
Diffstat (limited to 'tests/units/volume.py')
-rwxr-xr-xtests/units/volume.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/tests/units/volume.py b/tests/units/volume.py
index feb616a..e9577b0 100755
--- a/tests/units/volume.py
+++ b/tests/units/volume.py
@@ -284,7 +284,7 @@ class VolumeTest(tests.Test):
sorted(self.call('GET', document='testdocument', reply=['prop', 'guid'])['result'][0].keys()))
self.assertEqual(
- sorted(['guid', 'prop']),
+ sorted(['prop']),
sorted(self.call('GET', document='testdocument', reply=['prop'])['result'][0].keys()))
def test_Command_NotModifiedGet(self):
@@ -407,7 +407,7 @@ class VolumeTest(tests.Test):
'value_ru',
self.call('GET', document='testdocument', guid=guid, accept_language=['ru', 'es'], prop='localized_prop'))
self.assertEqual(
- [{'guid': guid, 'localized_prop': 'value_ru'}],
+ [{'localized_prop': 'value_ru'}],
self.call('GET', document='testdocument', accept_language=['foo', 'ru', 'es'], reply=['localized_prop'])['result'])
self.assertEqual(
@@ -417,7 +417,7 @@ class VolumeTest(tests.Test):
'value_ru',
self.call('GET', document='testdocument', guid=guid, accept_language=['ru-RU', 'es'], prop='localized_prop'))
self.assertEqual(
- [{'guid': guid, 'localized_prop': 'value_ru'}],
+ [{'localized_prop': 'value_ru'}],
self.call('GET', document='testdocument', accept_language=['foo', 'ru-RU', 'es'], reply=['localized_prop'])['result'])
self.assertEqual(
@@ -427,7 +427,7 @@ class VolumeTest(tests.Test):
'value_es',
self.call('GET', document='testdocument', guid=guid, accept_language=['es', 'ru'], prop='localized_prop'))
self.assertEqual(
- [{'guid': guid, 'localized_prop': 'value_es'}],
+ [{'localized_prop': 'value_es'}],
self.call('GET', document='testdocument', accept_language=['foo', 'es', 'ru'], reply=['localized_prop'])['result'])
self.assertEqual(
@@ -437,7 +437,7 @@ class VolumeTest(tests.Test):
'value_en',
self.call('GET', document='testdocument', guid=guid, accept_language=['fr', 'za'], prop='localized_prop'))
self.assertEqual(
- [{'guid': guid, 'localized_prop': 'value_en'}],
+ [{'localized_prop': 'value_en'}],
self.call('GET', document='testdocument', accept_language=['foo', 'fr', 'za'], reply=['localized_prop'])['result'])
env.DEFAULT_LANG = 'foo'
@@ -450,7 +450,7 @@ class VolumeTest(tests.Test):
'value_%s' % fallback_lang,
self.call('GET', document='testdocument', guid=guid, accept_language=['fr', 'za'], prop='localized_prop'))
self.assertEqual(
- [{'guid': guid, 'localized_prop': 'value_%s' % fallback_lang}],
+ [{'localized_prop': 'value_%s' % fallback_lang}],
self.call('GET', document='testdocument', accept_language=['foo', 'fr', 'za'], reply=['localized_prop'])['result'])
def test_LazyOpen(self):
@@ -956,6 +956,24 @@ class VolumeTest(tests.Test):
coroutine.dispatch()
self.assertEqual('0!1!', ''.join(self.call('GET', document='testdocument', guid=guid, prop='blob')))
+ def test_Group(self):
+
+ class TestDocument(Document):
+
+ @active_property(slot=1)
+ def prop(self, value):
+ return value
+
+ self.volume = SingleVolume(tests.tmpdir, [TestDocument])
+
+ self.call('POST', document='testdocument', content={'prop': 1})
+ self.call('POST', document='testdocument', content={'prop': 2})
+ self.call('POST', document='testdocument', content={'prop': 1})
+
+ self.assertEqual(
+ sorted([{'prop': '1'}, {'prop': '2'}]),
+ sorted(self.call('GET', document='testdocument', reply='prop', group_by='prop')['result']))
+
def call(self, method, document=None, guid=None, prop=None,
accept_language=None, content=None, content_stream=None,
if_modified_since=None, **kwargs):