summaryrefslogtreecommitdiff
path: root/tests/test_couchdb.py
blob: 582850865241aca75f6a2976dafa5e89658337b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()