forked from OpenBazaar/OpenBazaar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_datastore.py
41 lines (31 loc) · 1.06 KB
/
test_datastore.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import unittest
import UserDict
import mock
from node import datastore, db_store
class TestSqliteDatastore(unittest.TestCase):
def setUp(self):
self.db_mock = mock.MagicMock(spec=db_store.Obdb)
data = {
'datastore': [
{'key': 'Zurich'.encode('hex')},
{'key': 'CH'.encode('hex')}
]
}
self.db_mock.select_entries.side_effect = data.__getitem__
self.sqlite_datastore = datastore.SqliteDataStore(self.db_mock)
def test_init(self):
self.assertIs(self.sqlite_datastore.db_connection, self.db_mock)
self.assertIsInstance(self.sqlite_datastore, UserDict.DictMixin)
def test_keys(self):
keys = self.sqlite_datastore.keys()
self.assertEqual(len(keys), 2)
self.assertIn('Zurich', keys)
self.assertIn('CH', keys)
def test_get_last_published(self):
pass
def test_get_original_publisher_id(self):
pass
def test_get_original_publish_time(self):
pass
def test_set_item(self):
pass