def test_initialize_existing_temp_file(self):
# Test that bandit does not run when the temporary output file exists
# when calling the initialize method
repo_directory = self.useFixture(fixtures.TempDir()).path
git_repo = git.Repo.init(repo_directory)
git_repo.index.commit('Initial Commit')
os.chdir(repo_directory)
# create an existing version of temporary output file
existing_temp_file = baseline.baseline_tmp_file
with open(existing_temp_file, 'wt') as fd:
fd.write(self.temp_file_contents)
return_value = baseline.initialize()
# assert bandit did not run due to existing temporary report file
self.assertEqual((None, None, None), return_value)
评论列表
文章目录