def test_removes_metadata_by_default(self, mocked_metadata_path, mocked_snapshot_symlink): repo = Repository("/tmp/backup") repo.cleanup() mocked_metadata_path.return_value.unlink.assert_called_once() mocked_snapshot_symlink.return_value.unlink.assert_called_once()
def test_stops_on_non_symlink_resistant(self): self.mocked_shutil["rmtree"].avoids_symlink_attacks = False repo = Repository("/tmp/backup") repo.cleanup(remove_snapshots=True) self.mocked_path["unlink"].assert_not_called() self.mocked_shutil["rmtree"].assert_not_called()
def test_removes_repo_dir(self): repo = Repository("/tmp/backup") repo.cleanup(remove_repo_dir=True) self.mocked_shutil["rmtree"].assert_called_once()