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-06-19 15:54:12 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-06-19 15:54:12 (GMT)
commitc7091e4a1df6ff625bb6b6dae42b503511f291ef (patch)
tree2b2da6814739898d14fa1e9ac754de4435535c7e /tests
parentf88cd477f1cdbe2513d78b6d9b374f6b5172ed8c (diff)
allow polymorphic Python property types more easily
don't trigger DBus errors on binary properties for no reason
Diffstat (limited to 'tests')
-rw-r--r--tests/test_model.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_model.py b/tests/test_model.py
index 40b1ef1..65da1eb 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1,8 +1,9 @@
import unittest
+from testutils import tmpData
+from olpc.datastore import DataStore
from olpc.datastore import model
import datetime
-import time
class Test(unittest.TestCase):
def test_dateproperty(self):
@@ -14,6 +15,17 @@ class Test(unittest.TestCase):
assert p.key == "ctime"
assert p.value.isoformat() == n.isoformat()
+ def test_binaryproperty(self):
+ ds = DataStore('/tmp/test_ds', 'sqlite://')
+
+ data = open('test.jpg', 'r').read()
+ # binary data with \0's in it can cause dbus errors here
+ uid = ds.create(dict(title="Document 1", thumbnail=data),
+ tmpData("with image\0\0 prop"))
+ c = ds.get(uid)
+ assert c.get_property('thumbnail') == data
+ ds.stop()
+
def test_suite():
suite = unittest.TestSuite()