Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Saller <bcsaller@objectrealms.net>2007-07-16 14:18:10 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-07-16 14:18:10 (GMT)
commit6df3576dcc93acafbb4d8d22dcd4ab284b64e412 (patch)
tree4020879ba0dd6aafcc8f775665742ad15e731432 /tests
parentd75494ee4695b2b8a08f8f18fe9abf53dcb6159c (diff)
resolve keys through model
removed testutils.waitforindex
Diffstat (limited to 'tests')
-rw-r--r--tests/milestone_1.txt3
-rw-r--r--tests/properties.txt2
-rw-r--r--tests/sugar_demo_may17.txt14
-rw-r--r--tests/test_backingstore.py6
-rw-r--r--tests/test_model.py16
-rw-r--r--tests/test_xapianindex.py7
-rw-r--r--tests/testutils.py4
7 files changed, 22 insertions, 30 deletions
diff --git a/tests/milestone_1.txt b/tests/milestone_1.txt
index 48d09bc..35e8fb6 100644
--- a/tests/milestone_1.txt
+++ b/tests/milestone_1.txt
@@ -12,7 +12,6 @@ datastore.
First, create and connect the store.
->>> from testutils import waitforindex
>>> import os
>>> assert os.system('rm -rf /tmp/test_ds') == 0
@@ -39,7 +38,7 @@ Note that we retain no reference to the created documents.
Now we should be able to test the first requirement.
* Get the unique ids of all the objects in the store.
->>> waitforindex(ds)
+>>> ds.complete_indexing()
>>> results, count = ds.find()
diff --git a/tests/properties.txt b/tests/properties.txt
index fe34782..4a95ec4 100644
--- a/tests/properties.txt
+++ b/tests/properties.txt
@@ -19,7 +19,7 @@ Set up two mount points.
Extend the model to retain a 'year' property used below.
->>> dm = model.defaultModel.copy().addField('year', "int")
+>>> dm = model.defaultModel.copy().addField('year', "number")
Mount a couple of stores.
diff --git a/tests/sugar_demo_may17.txt b/tests/sugar_demo_may17.txt
index f242140..64d49e5 100644
--- a/tests/sugar_demo_may17.txt
+++ b/tests/sugar_demo_may17.txt
@@ -2,7 +2,6 @@ How Sugar will interact with the DS for the May 17th demo in Argentina:
>>> from olpc.datastore import DataStore
>>> from olpc.datastore import backingstore
->>> from testutils import waitforindex
>>> ds = DataStore()
>>> ds.registerBackend(backingstore.FileBackingStore)
>>> assert ds.mount("/tmp/test_ds")
@@ -10,15 +9,16 @@ How Sugar will interact with the DS for the May 17th demo in Argentina:
Create an entry without data:
>>> uid = ds.create(dict(title="New entry"), '')
->>> waitforindex(ds)
+>>> ds.complete_indexing()
>>> ds.get_filename(uid)
''
Update an entry without data:
>>> ds.update(uid, dict(title="New entry still without content"), '')
->>> waitforindex(ds)
-
+
+>>> ds.complete_indexing()
+
>>> ds.get_filename(uid)
''
@@ -27,7 +27,7 @@ Add some data to the same entry:
>>> print >>fp, "some content"
>>> fp.close()
>>> ds.update(uid, dict(title="Same entry now with some content"), fp.name)
->>> waitforindex(ds)
+>>> ds.complete_indexing()
Retrieve that data:
>>> fn = ds.get_filename(uid)
@@ -41,7 +41,7 @@ Update again:
>>> print >>fp, "some other content"
>>> fp.close()
>>> ds.update(uid, dict(title="Same entry with some other content"), fp.name)
->>> waitforindex(ds)
+>>> ds.complete_indexing()
And retrieve again:
>>> fn = ds.get_filename(uid)
@@ -66,7 +66,7 @@ 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')
->>> waitforindex(ds)
+>>> ds.complete_indexing()
>>> ds.stop()
>>> del ds
diff --git a/tests/test_backingstore.py b/tests/test_backingstore.py
index 8aab9e6..4138219 100644
--- a/tests/test_backingstore.py
+++ b/tests/test_backingstore.py
@@ -1,5 +1,5 @@
import unittest
-from testutils import tmpData, waitforindex
+from testutils import tmpData
from olpc.datastore import backingstore
import os
@@ -30,7 +30,7 @@ class Test(unittest.TestCase):
uid = bs.create(dict(title="A"), tmpData(d))
- waitforindex(bs)
+ bs.complete_indexing()
obj = bs.get(uid)
@@ -40,7 +40,7 @@ class Test(unittest.TestCase):
bs.update(uid, dict(title="B"), tmpData(d2))
- waitforindex(bs)
+ bs.complete_indexing()
obj = bs.get(uid)
assert obj.get_property('title') == "B"
diff --git a/tests/test_model.py b/tests/test_model.py
index 87ed94f..145f5d8 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1,5 +1,5 @@
import unittest
-from testutils import tmpData, waitforindex
+from testutils import tmpData
from olpc.datastore import DataStore
from olpc.datastore import model, backingstore
@@ -20,10 +20,9 @@ class Test(unittest.TestCase):
n = n.replace(microsecond=0)
p = model.Property('ctime', n.isoformat(), 'date')
assert p.key == "ctime"
- # XXX: the 'date()' is a work around for a missing secore
- # feature right now
- assert p.value == n.date().isoformat()
-
+ assert p.value == n.isoformat()
+ p.value = p.value
+ assert p.value == n.isoformat()
def test_binaryproperty(self):
ds = DataStore()
@@ -39,11 +38,10 @@ class Test(unittest.TestCase):
data = open('test.jpg', 'r').read()
# binary data with \0's in it can cause dbus errors here
fn = tmpData("with image\0\0 prop")
- # XXX: We should be able to remove:binary now
- uid = ds.create({'title' : "Document 1", 'thumbnail:binary' :
- data, 'ctime:date' : n.isoformat()}, fn)
+ # The key types are looked up in the model now
+ uid = ds.create({'title' : "Document 1", 'thumbnail' : data, 'ctime' : n.isoformat()}, fn)
- waitforindex(ds)
+ ds.complete_indexing()
c = ds.get(uid)
assert c.get_property('thumbnail') == data
diff --git a/tests/test_xapianindex.py b/tests/test_xapianindex.py
index 3d39d3e..c455c44 100644
--- a/tests/test_xapianindex.py
+++ b/tests/test_xapianindex.py
@@ -16,16 +16,15 @@ def index_file(iconn, filepath):
main, subtype = mimetype.split('/',1)
stat = os.stat(filepath)
- ctime = datetime.fromtimestamp(stat.st_ctime)
- mtime = datetime.fromtimestamp(stat.st_mtime)
+ ctime = datetime.fromtimestamp(stat.st_ctime).isoformat()
+ mtime = datetime.fromtimestamp(stat.st_mtime).isoformat()
if main in ['image']: filepath = None
if subtype in ['x-trash', 'x-python-bytecode']: filepath = None
- props = {'mime_type' : mimetype, 'mtime:date' : mtime,
- 'ctime:date' : ctime,}
+ props = {'mime_type' : mimetype, 'mtime' : mtime, 'ctime' : ctime,}
if filepath:
fn = os.path.split(filepath)[1]
diff --git a/tests/testutils.py b/tests/testutils.py
index a4efc0a..fc667db 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -8,7 +8,3 @@ def tmpData(data):
os.close(fd)
return fn
-def waitforindex(obj):
- # wait for any/all index managers associated with object to finish
- # indexing so that tests can do there thing
- obj.complete_indexing()