def test_clear_directory(self): for file_name in ('one', 'two', 'three'): touch(os.path.join(self.working_dir, file_name)) os.makedirs(os.path.join(self.working_dir, 'four')) self.assertEqual(len(os.listdir(self.working_dir)), 4) step = PublishStep("foo") step._clear_directory(self.working_dir, ['two']) self.assertEqual(len(os.listdir(self.working_dir)), 1)
def test_clear_directory(self, mock_clear): step = PublishStep("foo") step._clear_directory(self.working_dir, ['two']) mock_clear.assert_called_once_with(self.working_dir, ['two'])
def test_clear_directory_that_does_not_exist(self): # If this doesn't throw we are ok step = PublishStep("foo") step._clear_directory(os.path.join(self.working_dir, 'imaginary'))