Binary content option, sync all option

This commit is contained in:
lash
2022-03-17 19:16:33 +00:00
parent 57a9ea44ff
commit 8ccc89b4a5
6 changed files with 53 additions and 18 deletions

View File

@@ -142,7 +142,7 @@ class TestStateReport(unittest.TestCase):
os.stat(fp)
def test_sync(self):
def test_sync_one(self):
self.states.put('abcd', state=self.states.FOO, contents='foo')
self.states.put('xxx', state=self.states.FOO)
self.states.put('yyy', state=self.states.FOO)
@@ -162,6 +162,25 @@ class TestStateReport(unittest.TestCase):
self.assertEqual(self.states.get('zzzz'), 'xyzzy')
def test_sync_all(self):
self.states.put('abcd', state=self.states.FOO)
self.states.put('xxx', state=self.states.BAR)
fp = os.path.join(self.d, 'FOO', 'abcd')
f = open(fp, 'w')
f.write('foofoo')
f.close()
fp = os.path.join(self.d, 'BAR', 'zzzz')
f = open(fp, 'w')
f.write('barbar')
f.close()
self.states.sync()
self.assertEqual(self.states.get('abcd'), None)
self.assertEqual(self.states.get('zzzz'), 'barbar')
def test_path(self):
self.states.put('yyy', state=self.states.FOO)

View File

@@ -80,5 +80,6 @@ class TestStateItems(unittest.TestCase):
self.assertIsNone(self.mockstore.v.get(item))
if __name__ == '__main__':
unittest.main()