Esempio n. 1
0
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
Esempio n. 2
0
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()
Esempio n. 3
0
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
Esempio n. 4
0
 def test_branch(self):
     sys.argv = [PATH, REPO]
     self.assertEqual(1, cli.run(branch="master"))
Esempio n. 5
0
 def test_remote_with_history(self):
     sys.argv = [PATH, REPO]
     self.assertEqual(1, cli.run(no_history=False, branch=None))
Esempio n. 6
0
 def test_local_directory_no_history(self):
     sys.argv = [PATH, "./tests"]
     self.assertEqual(1, cli.run(no_history=True, json=True))
Esempio n. 7
0
 def test_local_file(self):
     sys.argv = [PATH, "./tests/test_slack_token.json"]
     self.assertEqual(1, cli.run(no_history=True, whitelist=[]))
Esempio n. 8
0
 def test_config_load(self):
     sys.argv = [PATH, "./tests", "-c", "./trufflehog.json.example"]
     self.assertEqual(1, cli.run(no_history=True))
Esempio n. 9
0
from truffleHog3 import cli

cli.run()
Esempio n. 10
0
from truffleHog3 import cli  # pragma: no cover

cli.run()  # pragma: no cover