fix: format all code with black
and from now on should not deviate from that...
This commit is contained in:
parent
2bd094b10b
commit
147d2fd871
17 changed files with 298 additions and 216 deletions
|
@ -12,26 +12,26 @@ from wuttamess import sync as mod
|
|||
class TestMakeRoot(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
root = mod.make_root('files')
|
||||
root = mod.make_root("files")
|
||||
self.assertIsInstance(root, SyncedRoot)
|
||||
self.assertEqual(root.src, Path('files'))
|
||||
self.assertEqual(root.dest, Path('/'))
|
||||
self.assertEqual(root.src, Path("files"))
|
||||
self.assertEqual(root.dest, Path("/"))
|
||||
|
||||
|
||||
class TestMakeSelector(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
selector = mod.make_selector('etc/postfix')
|
||||
selector = mod.make_selector("etc/postfix")
|
||||
self.assertIsInstance(selector, ItemSelector)
|
||||
self.assertEqual(selector.subpath, Path('etc/postfix'))
|
||||
self.assertEqual(selector.subpath, Path("etc/postfix"))
|
||||
|
||||
|
||||
class TestIsync(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
root = mod.make_root('files')
|
||||
with patch.object(mod, 'fabsync') as fabsync:
|
||||
root = mod.make_root("files")
|
||||
with patch.object(mod, "fabsync") as fabsync:
|
||||
fabsync.ItemSelector = ItemSelector
|
||||
|
||||
# nothing to sync
|
||||
|
@ -42,7 +42,7 @@ class TestIsync(TestCase):
|
|||
|
||||
# sync one file
|
||||
fabsync.isync.reset_mock()
|
||||
result = MagicMock(path='/foo', modified=True)
|
||||
result = MagicMock(path="/foo", modified=True)
|
||||
fabsync.isync.return_value = [result]
|
||||
results = list(mod.isync(c, root))
|
||||
self.assertEqual(results, [result])
|
||||
|
@ -50,34 +50,38 @@ class TestIsync(TestCase):
|
|||
|
||||
# sync with selector (subpath)
|
||||
fabsync.isync.reset_mock()
|
||||
result = MagicMock(path='/foo', modified=True)
|
||||
result = MagicMock(path="/foo", modified=True)
|
||||
fabsync.isync.return_value = [result]
|
||||
results = list(mod.isync(c, root, 'foo'))
|
||||
results = list(mod.isync(c, root, "foo"))
|
||||
self.assertEqual(results, [result])
|
||||
fabsync.isync.assert_called_once_with(c, root, selector=fabsync.ItemSelector.new('foo'))
|
||||
fabsync.isync.assert_called_once_with(
|
||||
c, root, selector=fabsync.ItemSelector.new("foo")
|
||||
)
|
||||
|
||||
# sync with selector (subpath + tags)
|
||||
fabsync.isync.reset_mock()
|
||||
result = MagicMock(path='/foo', modified=True)
|
||||
result = MagicMock(path="/foo", modified=True)
|
||||
fabsync.isync.return_value = [result]
|
||||
results = list(mod.isync(c, root, 'foo', tags={'bar'}))
|
||||
results = list(mod.isync(c, root, "foo", tags={"bar"}))
|
||||
self.assertEqual(results, [result])
|
||||
fabsync.isync.assert_called_once_with(c, root, selector=fabsync.ItemSelector.new('foo', tags={'bar'}))
|
||||
fabsync.isync.assert_called_once_with(
|
||||
c, root, selector=fabsync.ItemSelector.new("foo", tags={"bar"})
|
||||
)
|
||||
|
||||
|
||||
class TestCheckIsync(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
root = mod.make_root('files')
|
||||
with patch.object(mod, 'isync') as isync:
|
||||
root = mod.make_root("files")
|
||||
with patch.object(mod, "isync") as isync:
|
||||
|
||||
# file(s) modified
|
||||
result = MagicMock(path='/foo', modified=True)
|
||||
result = MagicMock(path="/foo", modified=True)
|
||||
isync.return_value = [result]
|
||||
self.assertTrue(mod.check_isync(c, root))
|
||||
|
||||
# not modified
|
||||
result = MagicMock(path='/foo', modified=False)
|
||||
result = MagicMock(path="/foo", modified=False)
|
||||
isync.return_value = [result]
|
||||
self.assertFalse(mod.check_isync(c, root))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue