Skip to content

Commit

Permalink
Disable boundaryless mode in click tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piatrashkakanstantinass committed Oct 11, 2021
1 parent cad871f commit c173aae
Showing 1 changed file with 34 additions and 29 deletions.
63 changes: 34 additions & 29 deletions tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

def test_nothing_found():
runner = CliRunner()
result = runner.invoke(main, [""])
result = runner.invoke(main, ["-db", ""])
assert result.exit_code == 0
assert "Nothing found!" in result.output


def test_hello_world():
runner = CliRunner()
result = runner.invoke(main, ["THM{this is a flag}"])
result = runner.invoke(main, ["-db", "THM{this is a flag}"])
assert result.exit_code == 0
assert "THM{" in result.output

Expand Down Expand Up @@ -47,14 +47,14 @@ def test_tag_printing():
def test_json_printing():
"""Test for valid json"""
runner = CliRunner()
result = runner.invoke(main, ["10.0.0.1", "--json"])
result = runner.invoke(main, ["-db", "10.0.0.1", "--json"])
assert json.loads(result.output.replace("\n", ""))


def test_json_printing2():
"""Test for empty json return"""
runner = CliRunner()
result = runner.invoke(main, ["", "--json"])
result = runner.invoke(main, ["-db", "", "--json"])
assert result.output.strip("\n") == '{"File Signatures": null, "Regexes": null}'


Expand Down Expand Up @@ -159,7 +159,7 @@ def test_file_fixture14():

def test_arg_parsing():
runner = CliRunner()
result = runner.invoke(main, ["1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
result = runner.invoke(main, ["-db", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"])
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))

Expand Down Expand Up @@ -223,7 +223,7 @@ def test_file_fixture_email():

def test_file_fixture_email2():
runner = CliRunner()
result = runner.invoke(main, ["firstname+lastname@example.com"])
result = runner.invoke(main, ["-db", "firstname+lastname@example.com"])
assert result.exit_code == 0
assert re.findall("Email", str(result.output))

Expand Down Expand Up @@ -251,28 +251,28 @@ def test_file_fixture_youtube_id():

def test_file_fixture_ip4():
runner = CliRunner()
result = runner.invoke(main, ["118.103.238.230"])
result = runner.invoke(main, ["-db", "118.103.238.230"])
assert result.exit_code == 0
assert re.findall("Address Version 4", str(result.output))


def test_file_fixture_ip4_shodan():
runner = CliRunner()
result = runner.invoke(main, ["118.103.238.230"])
result = runner.invoke(main, ["-db", "118.103.238.230"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))


def test_file_fixture_ip6():
runner = CliRunner()
result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("Address Version 6", str(result.output))


def test_file_fixture_ip6_shodan():
runner = CliRunner()
result = runner.invoke(main, ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
result = runner.invoke(main, ["-db", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"])
assert result.exit_code == 0
assert re.findall("shodan", str(result.output))

Expand All @@ -294,7 +294,7 @@ def test_file_pcap():

def test_file_coords():
runner = CliRunner()
result = runner.invoke(main, ["52.6169586, -1.9779857"])
result = runner.invoke(main, ["-db", "52.6169586, -1.9779857"])
assert result.exit_code == 0
assert re.findall("Latitude", str(result.output))

Expand Down Expand Up @@ -323,7 +323,7 @@ def test_file_fixture_bch():
def test_file_fixture_bch2():
runner = CliRunner()
result = runner.invoke(
main, ["bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
main, ["-db", "bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq"]
)
assert result.exit_code == 0
assert re.findall("blockchain", str(result.output))
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_file_fixture_xmr():

def test_file_cors():
runner = CliRunner()
result = runner.invoke(main, ["Access-Control-Allow: *"])
result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
assert result.exit_code == 0
assert re.findall("Access", str(result.output))

Expand All @@ -362,7 +362,8 @@ def test_file_jwt():
result = runner.invoke(
main,
[
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
"-db",
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
],
)
assert result.exit_code == 0
Expand All @@ -371,36 +372,38 @@ def test_file_jwt():

def test_file_s3():
runner = CliRunner()
result = runner.invoke(main, ["http://s3.amazonaws.com/bucket/"])
result = runner.invoke(main, ["-db", "http://s3.amazonaws.com/bucket/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))


def test_file_s3_2():
runner = CliRunner()
result = runner.invoke(main, ["s3://bucket/path/key"])
result = runner.invoke(main, ["-db", "s3://bucket/path/key"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))


def test_file_s3_3():
runner = CliRunner()
result = runner.invoke(main, ["s3://bucket/path/directory/"])
result = runner.invoke(main, ["-db", "s3://bucket/path/directory/"])
assert result.exit_code == 0
assert re.findall("S3", str(result.output))


def test_file_arn():
runner = CliRunner()
result = runner.invoke(main, ["arn:partition:service:region:account-id:resource"])
result = runner.invoke(
main, ["-db", "arn:partition:service:region:account-id:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))


def test_file_arn2():
runner = CliRunner()
result = runner.invoke(
main, ["arn:partition:service:region:account-id:resourcetype/resource"]
main, ["-db", "arn:partition:service:region:account-id:resourcetype/resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))
Expand All @@ -409,57 +412,59 @@ def test_file_arn2():
def test_file_arn3():
runner = CliRunner()
result = runner.invoke(
main, ["arn:partition:service:region:account-id:resourcetype:resource"]
main, ["-db", "arn:partition:service:region:account-id:resourcetype:resource"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))


def test_file_arn4():
runner = CliRunner()
result = runner.invoke(main, ["arn:aws:s3:::my_corporate_bucket/Development/*"])
result = runner.invoke(
main, ["-db", "arn:aws:s3:::my_corporate_bucket/Development/*"]
)
assert result.exit_code == 0
assert re.findall("ARN", str(result.output))


def test_key_value_min_rarity_0():
runner = CliRunner()
result = runner.invoke(main, ["--rarity", "0:", "key:value"])
result = runner.invoke(main, ["-db", "--rarity", "0:", "key:value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))


def test_key_value_min_rarity_0_1():
runner = CliRunner()
result = runner.invoke(main, ["--rarity", "0:", "key : value"])
result = runner.invoke(main, ["-db", "--rarity", "0:", "key : value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))


def test_key_value_min_rarity_0_2():
runner = CliRunner()
result = runner.invoke(main, ["--rarity", "0:", "key: value"])
result = runner.invoke(main, ["-db", "--rarity", "0:", "key: value"])
assert result.exit_code == 0
assert re.findall("Key:Value", str(result.output))


def test_key_value_min_rarity_0_3():
runner = CliRunner()
result = runner.invoke(main, ["--rarity", "0:", ":a:"])
result = runner.invoke(main, ["-db", "--rarity", "0:", ":a:"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))


def test_key_value_min_rarity_0_4():
runner = CliRunner()
result = runner.invoke(main, ["--rarity", "0:", ":::::"])
result = runner.invoke(main, ["-db", "--rarity", "0:", ":::::"])
assert result.exit_code == 0
assert not re.findall("Key:Value", str(result.output))


def test_key_value_min_rarity_0_5():
runner = CliRunner()
result = runner.invoke(main, ["--rarity", "0:", "a:b:c"])
result = runner.invoke(main, ["-db", "--rarity", "0:", "a:b:c"])
assert result.exit_code == 0
assert not re.findall("a:b:c", str(result.output))

Expand Down Expand Up @@ -580,14 +585,14 @@ def test_file_fixture_turkish_car_plate():

def test_file_fixture_date_of_birth():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
result = runner.invoke(main, ["-db", "fixtures/file"])
assert result.exit_code == 0
assert re.findall("Date of Birth", str(result.output))


def test_file_fixture_turkish_id_number():
runner = CliRunner()
result = runner.invoke(main, ["fixtures/file"])
result = runner.invoke(main, ["-db", "fixtures/file"])
assert result.exit_code == 0
assert re.findall("Turkish Identification Number", str(result.output))

Expand Down

0 comments on commit c173aae

Please sign in to comment.