diff options
Diffstat (limited to 'tests/properties.txt')
-rw-r--r-- | tests/properties.txt | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/tests/properties.txt b/tests/properties.txt deleted file mode 100644 index 6c3c91b..0000000 --- a/tests/properties.txt +++ /dev/null @@ -1,47 +0,0 @@ -This document shows off the range of features available for attaching -properties to content and managing them. - -(clean up) ->>> import os ->>> assert os.system('rm -rf /tmp/store1/') == 0 ->>> assert os.system('rm -rf /tmp/store2/') == 0 - - ->>> from olpc.datastore import DataStore ->>> from olpc.datastore import backingstore, model ->>> from testutils import tmpData ->>> import dbus - -Set up two mount points. - ->>> ds = DataStore() ->>> ds.registerBackend(backingstore.FileBackingStore) - -Extend the model to retain a 'year' property used below. - -Mount a couple of stores. - ->>> mp1 = ds.mount("/tmp/store1", {'title' : "Primary Storage",}) ->>> mp2 = ds.mount("/tmp/store2", {'title' : "Secondary Storage"}) - -Create some content on each. - ->>> u1 = ds.create({'title' : "Alpha doc", 'author' : "Ben", 'year:int' : 2000}, tmpData("""Document 1""")) ->>> u2 = ds.create({'title' : "Beta doc", 'author' : "Ben", 'year:int' : 2001} , tmpData("""Document 2""")) - ->>> u3 = ds.create({'title' : "Delta doc", 'author' :"HAL", 'year:int' : 2000, 'mountpoint' : mp2}, tmpData("""Document 3""")) ->>> u4 = ds.create({'title' : "Gamma doc", 'author' : "HAL", 'year:int' : 2001, 'mountpoint' : mp2}, tmpData("""Document 4""")) - -Now we should be able to discover things about the system properties. ->>> ds.complete_indexing() - -Here we test that we can extract the unique values for certain properties. ->>> assert set(ds.get_uniquevaluesfor('author')) == set(['Ben', 'HAL']) - -Here we try to gather the values for the property year. - ->>> assert set(ds.get_uniquevaluesfor('year')) == set([2000, 2001]) - - - ->>> ds.stop(); del ds |