summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2012-12-10 18:39:56 -0200
committerdrebs <drebs@leap.se>2012-12-10 18:39:56 -0200
commit64347825e57076560fa32b24df0ed2b310d4e052 (patch)
treecbe88e64d129ec0a7b8a70cba5467a6fb8cce0a1 /tests
parente21b1cbe95dd3c424e0fe83f27ef439d7ab8cc76 (diff)
CouchDB backend can put and get objects.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_couchdb.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_couchdb.py b/tests/test_couchdb.py
new file mode 100644
index 00000000..58285086
--- /dev/null
+++ b/tests/test_couchdb.py
@@ -0,0 +1,19 @@
+import unittest
+from soledad.backends.couch import CouchDatabase
+
+class CouchTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self._db = CouchDatabase('http://localhost:5984', 'u1db_tests')
+
+ def test_create_get(self):
+ doc1 = self._db.create_doc({"key": "value"}, doc_id="testdoc")
+ doc2 = self._db.get_doc('testdoc')
+ self.assertEqual(doc1, doc2, 'error storing/retrieving document.')
+ self.assertEqual(self._db._get_generation(), 1)
+
+ def tearDown(self):
+ self._db._server.delete('u1db_tests')
+
+if __name__ == '__main__':
+ unittest.main()