def test_run_scan(repo: Repo, tmpdir: str): expected = os.path.join(tmpdir, "repo.json") path, _ = repo args = ["", path, "-f", "json", "--output", expected] with patch.object(sys, "argv", args): cli.run() assert len(utils.load(expected)) == 4
def test_run_render(datadir: str, tmpdir: str): report_json = os.path.join(datadir, "report.json") original = os.path.join(datadir, "report.html") expected = os.path.join(tmpdir, "report.html") args = ["", "--render-html", report_json, "--output", expected] with patch.object(sys, "argv", args): cli.run() with open(original) as f1, open(expected) as f2: assert f1.read() == f2.read()
def test_run_scan_with_config(repo: Repo, datadir: str, tmpdir: str): expected = os.path.join(tmpdir, "repo.json") path, _ = repo args = [ "", path, "-f", "json", "--output", expected, "-c", os.path.join(datadir, config_json), ] with patch.object(sys, "argv", args): cli.run() assert len(utils.load(expected)) == 3
def test_branch(self): sys.argv = [PATH, REPO] self.assertEqual(1, cli.run(branch="master"))
def test_remote_with_history(self): sys.argv = [PATH, REPO] self.assertEqual(1, cli.run(no_history=False, branch=None))
def test_local_directory_no_history(self): sys.argv = [PATH, "./tests"] self.assertEqual(1, cli.run(no_history=True, json=True))
def test_local_file(self): sys.argv = [PATH, "./tests/test_slack_token.json"] self.assertEqual(1, cli.run(no_history=True, whitelist=[]))
def test_config_load(self): sys.argv = [PATH, "./tests", "-c", "./trufflehog.json.example"] self.assertEqual(1, cli.run(no_history=True))
from truffleHog3 import cli cli.run()
from truffleHog3 import cli # pragma: no cover cli.run() # pragma: no cover