fix: add sync.make_selector()
convenience function
wraps `fabsync.ItemSelector.new()`
This commit is contained in:
parent
2a83142d95
commit
e3b593d628
2 changed files with 45 additions and 5 deletions
|
@ -18,6 +18,14 @@ class TestMakeRoot(TestCase):
|
|||
self.assertEqual(root.dest, Path('/'))
|
||||
|
||||
|
||||
class TestMakeSelector(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
selector = mod.make_selector('etc/postfix')
|
||||
self.assertIsInstance(selector, ItemSelector)
|
||||
self.assertEqual(selector.subpath, Path('etc/postfix'))
|
||||
|
||||
|
||||
class TestIsync(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
|
@ -40,7 +48,7 @@ class TestIsync(TestCase):
|
|||
self.assertEqual(results, [result])
|
||||
fabsync.isync.assert_called_once_with(c, root)
|
||||
|
||||
# sync with selector
|
||||
# sync with selector (subpath)
|
||||
fabsync.isync.reset_mock()
|
||||
result = MagicMock(path='/foo', modified=True)
|
||||
fabsync.isync.return_value = [result]
|
||||
|
@ -48,6 +56,14 @@ class TestIsync(TestCase):
|
|||
self.assertEqual(results, [result])
|
||||
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)
|
||||
fabsync.isync.return_value = [result]
|
||||
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'}))
|
||||
|
||||
|
||||
class TestCheckIsync(TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue