diff options
Diffstat (limited to 'tests/sugar_demo_may17.txt')
-rw-r--r-- | tests/sugar_demo_may17.txt | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/tests/sugar_demo_may17.txt b/tests/sugar_demo_may17.txt deleted file mode 100644 index 64d49e5..0000000 --- a/tests/sugar_demo_may17.txt +++ /dev/null @@ -1,72 +0,0 @@ -How Sugar will interact with the DS for the May 17th demo in Argentina: - ->>> from olpc.datastore import DataStore ->>> from olpc.datastore import backingstore ->>> ds = DataStore() ->>> ds.registerBackend(backingstore.FileBackingStore) ->>> assert ds.mount("/tmp/test_ds") - - -Create an entry without data: ->>> uid = ds.create(dict(title="New entry"), '') ->>> ds.complete_indexing() - ->>> ds.get_filename(uid) -'' - -Update an entry without data: ->>> ds.update(uid, dict(title="New entry still without content"), '') - ->>> ds.complete_indexing() - ->>> ds.get_filename(uid) -'' - -Add some data to the same entry: ->>> fp = open('/tmp/sugar_ds_test', 'w') ->>> print >>fp, "some content" ->>> fp.close() ->>> ds.update(uid, dict(title="Same entry now with some content"), fp.name) ->>> ds.complete_indexing() - -Retrieve that data: ->>> fn = ds.get_filename(uid) ->>> fp = open(fn, 'r') ->>> fp.read() -'some content\n' ->>> fp.close() - -Update again: ->>> fp = open('/tmp/sugar_ds_test2', 'w') ->>> print >>fp, "some other content" ->>> fp.close() ->>> ds.update(uid, dict(title="Same entry with some other content"), fp.name) ->>> ds.complete_indexing() - -And retrieve again: ->>> fn = ds.get_filename(uid) ->>> fp = open(fn, 'r') ->>> fp.read() -'some other content\n' ->>> fp.close() - -Get all entries (only have one): ->>> results, count = ds.find({}) ->>> results[0]['title'] -'Same entry with some other content' - -Check content: ->>> fn = ds.get_filename(uid) ->>> fp = open(fn, 'r') ->>> fp.read() -'some other content\n' ->>> fp.close() - -Set content as pdf: ->>> ds.update(uid, dict(title="Same entry with some content in pdf"), 'test.pdf') ->>> ds.update(uid, dict(title="Same entry with some content in doc"), 'test.doc') ->>> ds.update(uid, dict(title="Same entry with some content in odt"), 'test.odt') ->>> ds.complete_indexing() - ->>> ds.stop() ->>> del ds |