Skip to content

Commit

Permalink
comment tests
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Aug 12, 2024
1 parent 70eba73 commit ad55c2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bbot/test/test_step_1/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,22 +775,26 @@ async def test_event_web_spider_distance(bbot_scanner):

def test_event_closest_host():
scan = Scanner()
# first event has a host
event1 = scan.make_event("evilcorp.com", "DNS_NAME", parent=scan.root_event)
assert event1.host == "evilcorp.com"
assert event1.closest_host == "evilcorp.com"
# second event has no host
event2 = scan.make_event("wat", "ASDF", parent=event1)
assert event2.host == None
assert event2.closest_host == "evilcorp.com"
# finding automatically uses the host from the first event
finding = scan.make_event({"path": "/tmp/asdf.txt", "description": "test"}, "FINDING", parent=event2)
assert finding.data["host"] == "evilcorp.com"
assert finding.host == "evilcorp.com"
# same with vuln
vuln = scan.make_event(
{"path": "/tmp/asdf.txt", "description": "test", "severity": "HIGH"}, "VULNERABILITY", parent=event2
)
assert vuln.data["host"] == "evilcorp.com"
assert vuln.host == "evilcorp.com"

# no host
# no host == not allowed
event3 = scan.make_event("wat", "ASDF", parent=scan.root_event)
assert event3.host == None
with pytest.raises(ValueError):
Expand Down

0 comments on commit ad55c2e

Please sign in to comment.