Add state test on sync test
This commit is contained in:
parent
f00cb9564d
commit
16d4898ff3
@ -71,12 +71,14 @@ class RocksDbStore:
|
||||
|
||||
r = []
|
||||
l = len(self.__path)
|
||||
for (k, v) in it:
|
||||
import sys
|
||||
for (kb, v) in it:
|
||||
k = kb.decode('utf-8')
|
||||
if len(k) < l or k[:l] != self.__path:
|
||||
break
|
||||
k = self.__from_path(s)
|
||||
kb = self.__to_key(k)
|
||||
k = self.__from_path(k)
|
||||
v = self.db.get(kb)
|
||||
sys.stderr.write('ls keys {} {} {}\n'.format(k, kb, v))
|
||||
r.append((k, v,))
|
||||
|
||||
return r
|
||||
|
@ -181,9 +181,17 @@ class TestFileStore(unittest.TestCase):
|
||||
f.write('barbar')
|
||||
f.close()
|
||||
|
||||
fp = os.path.join(self.d, 'BAR', 'yyyy')
|
||||
f = open(fp, 'w')
|
||||
f.close()
|
||||
|
||||
self.states.sync()
|
||||
self.assertEqual(self.states.get('abcd'), None)
|
||||
self.assertEqual(self.states.state('abcd'), self.states.FOO)
|
||||
self.assertEqual(self.states.get('zzzz'), 'barbar')
|
||||
self.assertEqual(self.states.state('zzzz'), self.states.BAR)
|
||||
self.assertEqual(self.states.get('yyyy'), None)
|
||||
self.assertEqual(self.states.state('yyyy'), self.states.BAR)
|
||||
|
||||
|
||||
def test_path(self):
|
||||
@ -234,5 +242,6 @@ class TestFileStore(unittest.TestCase):
|
||||
self.assertEqual(r, 'foo')
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user