Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/basic_api_v2.txt
diff options
context:
space:
mode:
authorSascha Silbe <silbe@activitycentral.com>2011-03-04 14:02:13 (GMT)
committer Sascha Silbe <silbe@activitycentral.com>2011-03-04 14:02:13 (GMT)
commitad3e6fafb99eca267fc2f470ea7b6cb5b43eec3d (patch)
tree3fff9bb06fd8ad7fbaf47d1ab17f2f765daaf128 /tests/basic_api_v2.txt
parent83d9f81b5e442cd8e9006ec9a474cf6d0913578f (diff)
parent4babd564825dbcad358f8992abcaeefde78943cd (diff)
Merge remote branch 'refs/remotes/origin/t/versions' into HEAD
* refs/remotes/origin/t/versions: (53 commits) Add gconf setting /desktop/sugar/datastore/max_versions Allow specifying the version_id of a new version. add missing pieces for last commit add compatibility with the old (unversioned) API New TopGit dependency: t/rainbow-0.8 fix 0.82 migration typos fix typos New TopGit dependency: t/migration-rebuild-index add metadata to Saved signal adjust wording to new API test suite: expect/filter out parent_id save(): ensure parent_id is set correctly in metadata index store: replace document if already in database (for change_metadata) change_metadata(): make sure timestamp is set, like we do for save() fix test suite failure fix migration of checksum entries work around Xapian returning incorrect match counts if offset/limit are used fix sort order in ambiguous cases, fix obscure test suite breakage due to overlapping timestamp values fix FileStore.retrieve() broken by last merge test_massops.py: test ordering of find() results (for all supported orders) and offset/limit (for default order) ...
Diffstat (limited to 'tests/basic_api_v2.txt')
-rw-r--r--tests/basic_api_v2.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/basic_api_v2.txt b/tests/basic_api_v2.txt
index d9a38ac..83c2bb2 100644
--- a/tests/basic_api_v2.txt
+++ b/tests/basic_api_v2.txt
@@ -61,9 +61,13 @@ Change some entries:
>>> ds.update(o1_uid, {'title': 'DS test object 1 updated', 'mime_type': 'text/plain', 'activity': 'org.sugarlabs.DataStoreTest1', 'tags': 'foo'}, '', False)
>>> ds.update(o2_uid, {'title': 'DS test object 2', 'mime_type': 'text/plain', 'activity': 'org.sugarlabs.DataStoreTest1', 'tags': 'bar baz'}, '', False)
>>> ds.update(o3_uid, {'title': 'DS test object 2', 'mime_type': 'text/html', 'activity': 'org.sugarlabs.DataStoreTest3', 'timestamp': 10000}, '', False)
+
+Note: This only gives this result with the non-version support compatibility because we didn't update the data, so change_metadata() could be used instead of save(). If we update the data, a new version will be created and because we backdate the timestamp the previous version would still be considered the "latest" one.
>>> sorted(to_native(ds.find({}, ['title', 'activity'], byte_arrays=True)[0]))
[{u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 1 updated'}, {u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 2'}, {u'activity': 'org.sugarlabs.DataStoreTest3', u'title': 'DS test object 2'}]
+previous: [dbus.Dictionary({dbus.String(u'title'): dbus.ByteArray('DS test object 1 updated', variant_level=1), dbus.String(u'activity'): dbus.ByteArray('org.sugarlabs.DataStoreTest1', variant_level=1)}, signature=dbus.Signature('sv')), dbus.Dictionary({dbus.String(u'title'): dbus.ByteArray('DS test object 2', variant_level=1), dbus.String(u'activity'): dbus.ByteArray('org.sugarlabs.DataStoreTest1', variant_level=1)}, signature=dbus.Signature('sv')), dbus.Dictionary({dbus.String(u'title'): dbus.ByteArray('DS test object 2', variant_level=1), dbus.String(u'activity'): dbus.ByteArray('org.sugarlabs.DataStoreTest3', variant_level=1)}, signature=dbus.Signature('sv'))]
+
Retrieve metadata for a single entry, ignoring variable data:
>>> d=dict(ds.get_properties(o3_uid, byte_arrays=True))
>>> del d['uid'], d['timestamp']
@@ -87,7 +91,7 @@ Find entries using "unknown" metadata (=> returns all entries):
You can specify a (primary) sort order. Please note that the secondary sort order is undefined / implementation-dependent.
>>> to_native(ds.find({'order_by': ['+title']}, ['title', 'activity'], byte_arrays=True)[0])
-[{u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 2'}, {u'activity': 'org.sugarlabs.DataStoreTest3', u'title': 'DS test object 2'}, {u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 1 updated'}]
+[{u'activity': 'org.sugarlabs.DataStoreTest3', u'title': 'DS test object 2'}, {u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 2'}, {u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 1 updated'}]
>>> to_native(ds.find({'order_by': ['-title']}, ['title', 'activity'], byte_arrays=True)[0])
[{u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 1 updated'}, {u'activity': 'org.sugarlabs.DataStoreTest1', u'title': 'DS test object 2'}, {u'activity': 'org.sugarlabs.DataStoreTest3', u'title': 'DS test object 2'}]