From 002d2bfdbc4ca62733478524ec588cf0aa9f9383 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 10 Dec 2012 18:39:56 -0200 Subject: CouchDB backend can put and get objects. --- src/leap/soledad/tests/test_couchdb.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/leap/soledad/tests/test_couchdb.py (limited to 'src/leap/soledad/tests/test_couchdb.py') diff --git a/src/leap/soledad/tests/test_couchdb.py b/src/leap/soledad/tests/test_couchdb.py new file mode 100644 index 00000000..58285086 --- /dev/null +++ b/src/leap/soledad/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() -- cgit v1.2.3