git @ Cat's Eye Technologies ellsync / 266d29b
Unit test for syncing a subdirectory of a stream. Chris Pressey 1 year, 6 months ago
1 changed file(s) with 15 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
8585 ''
8686 ])
8787
88 def test_sync_subdirectory(self):
89 check_call("mkdir -p canonical/subdir", shell=True)
90 check_call("mkdir -p cache/subdir", shell=True)
91 check_call("touch canonical/subdir/stuff", shell=True)
92 main(['backup.json', 'sync', 'basic:subdir', '--apply'])
93 self.assertTrue(os.path.exists('cache/subdir/stuff'))
94 self.assertFalse(os.path.exists('cache/thing'))
95 output = sys.stdout.getvalue()
96 self.assertEqual(output.split('\n')[:4], [
97 'rsync --archive --verbose --delete "canonical/subdir/" "cache/subdir/"',
98 'sending incremental file list',
99 'stuff',
100 ''
101 ])
102
88103 def test_sync_stream_does_not_exist(self):
89104 with self.assertRaises(ValueError) as ar:
90105 main(['backup.json', 'sync', 'notfound', '--apply'])