diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-13 03:47:35 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-13 03:47:35 (GMT) |
commit | 32728d52c6099933df7d452003248634c61b07a2 (patch) | |
tree | 910733ca5ad77f8215f64f39eadb49df7b2c9443 /bin | |
parent | 5318b51b6f943e80ae1d99effd2219719db4ec7f (diff) |
more explicit testing of dbus interfaces and binary content indexing
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/sample-client.py | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/bin/sample-client.py b/bin/sample-client.py index 9a2aa2f..2a2b19c 100755 --- a/bin/sample-client.py +++ b/bin/sample-client.py @@ -8,32 +8,59 @@ def main(): "/org/laptop/sugar/DataStore") uid = datastore.create(dict(title="from dbus", author="Benjamin"), os.path.abspath('tests/test.pdf')) - print "created uid", uid + print "created uid", uid, "with binary content" datastore.complete_indexing() - print "find", datastore.find(dict(author="Benjamin", title="from")) res, count = datastore.find(dict(fulltext="peek")) - if not res: - print "unable to index content" - #return - print "bcsaller", [item['uid'] for item in res] - - print "huh?", datastore.find(dict(fulltext="kfdshaksjd")) - + assert count == 1, "failed to index content" + assert res[0]['uid'] == uid, "returned incorrect results" + print "found inside binary file :: PDF" + + assert datastore.find(dict(fulltext="kfdshaksjd"))[1] == 0 + print "successfully ignored bad searches" + # try the other mimetypes - datastore.update(uid, dict(title="updated title", mime_type="application/msword"), os.path.abspath('tests/test.doc')) - print datastore.find(dict(fulltext="inside")) - datastore.update(uid, dict(title="another updated title", mime_type="application/vnd.oasis.opendocument.text"), os.path.abspath('tests/test.odt')) - print datastore.find(dict(fulltext="amazed")) + datastore.update(uid, dict(title="updated title", + mime_type="application/msword"), + os.path.abspath('tests/test.doc')) datastore.complete_indexing() + + assert datastore.find(dict(fulltext="inside"))[0][0]['uid'] == uid + print "found in binary file :: WORD" + + datastore.update(uid, dict(title="another updated title", + mime_type="application/vnd.oasis.opendocument.text"), + os.path.abspath('tests/test.odt')) + datastore.complete_indexing() + + assert datastore.find(dict(fulltext="amazed"))[0][0]['uid'] == uid + print "found in binary file :: ODT" + datastore.get_properties(uid) - print "title in fulltext", datastore.find(dict(title="another")) - + assert datastore.find(dict(title="another"))[0][0]['uid'] == uid + print "found title using dict params", + + assert datastore.find("another")[0][0]['uid'] == uid + print "found title in search of all fields (as text)" + + + assert datastore.find('title:"another"')[0][0]['uid'] == uid + print "field in query field:'value' " + datastore.delete(uid) datastore.complete_indexing() + + print "deleted", uid + try: datastore.get_properties(uid) + except: pass + else: + print "Found deleted value... oops" + raise KeyError(uid) + + print "ALL GOOD" if __name__ == '__main__': #from ore.main import Application |