Unit test for syncing a subdirectory of a stream.
Chris Pressey
2 years ago
85 | 85 | '' |
86 | 86 | ]) |
87 | 87 | |
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 | ||
88 | 103 | def test_sync_stream_does_not_exist(self): |
89 | 104 | with self.assertRaises(ValueError) as ar: |
90 | 105 | main(['backup.json', 'sync', 'notfound', '--apply']) |