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

cli.run()
예제 #10
0
from truffleHog3 import cli  # pragma: no cover

cli.run()  # pragma: no cover