Skip to content

Commit

Permalink
Refined Newsletter Test, Updated Poetry, Ran Black
Browse files Browse the repository at this point in the history
  • Loading branch information
stryker2k2 committed Feb 8, 2024
1 parent eccb7a9 commit bb7a55c
Show file tree
Hide file tree
Showing 3 changed files with 247 additions and 243 deletions.
8 changes: 5 additions & 3 deletions bbot/test/test_step_1/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ async def test_events(events, scan, helpers, bbot_config):
assert scan.make_event("テスト@ドメイン.テスト", dummy=True).data == "テスト@xn--eckwd4c7c.xn--zckzah"
assert scan.make_event("ドメイン.テスト:80", dummy=True).data == "xn--eckwd4c7c.xn--zckzah:80"
assert scan.make_event("http://ドメイン.テスト:80", dummy=True).data == "http://xn--eckwd4c7c.xn--zckzah/"
assert scan.make_event("http://ドメイン.テスト:80/テスト", dummy=True).data == "http://xn--eckwd4c7c.xn--zckzah/テスト"
assert (
scan.make_event("http://ドメイン.テスト:80/テスト", dummy=True).data
== "http://xn--eckwd4c7c.xn--zckzah/テスト"
)
# thai
assert (
scan.make_event("xn--12c1bik6bbd8ab6hd1b5jc6jta.com", dummy=True).data == "xn--12c1bik6bbd8ab6hd1b5jc6jta.com"
Expand Down Expand Up @@ -356,8 +359,7 @@ async def test_events(events, scan, helpers, bbot_config):
assert scan.make_event("ทดสอบ@เราเที่ยวด้วยกัน.com", dummy=True).data == "ทดสอบ@xn--12c1bik6bbd8ab6hd1b5jc6jta.com"
assert scan.make_event("เราเที่ยวด้วยกัน.com:80", dummy=True).data == "xn--12c1bik6bbd8ab6hd1b5jc6jta.com:80"
assert (
scan.make_event("http://เราเที่ยวด้วยกัน.com:80", dummy=True).data
== "http://xn--12c1bik6bbd8ab6hd1b5jc6jta.com/"
scan.make_event("http://เราเที่ยวด้วยกัน.com:80", dummy=True).data == "http://xn--12c1bik6bbd8ab6hd1b5jc6jta.com/"
)
assert (
scan.make_event("http://เราเที่ยวด้วยกัน.com:80/ทดสอบ", dummy=True).data
Expand Down
20 changes: 9 additions & 11 deletions bbot/test/test_step_2/module_tests/test_module_newsletters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ async def setup_after_prep(self, module_test):
module_test.set_expect_requests(request_args, respond_args)

def check(self, module_test, events):
status = 0
found = False
missing = True
for event in events:
self.log.info(f"event type: {event.type}")
# self.log.info(f"event type: {event.type}")
if event.type == "FINDING":
self.log.info(f"event data: {event.data}")
# self.log.info(f"event data: {event.data}")
# Verify Positive Result
if event.data["host"] == self.found_tgt:
status = 1
elif event.data["url"] == self.found_tgt:
status = 1
if event.data["url"] == self.found_tgt:
found = True
# Verify Negative Result (should skip this statement if correct)
elif event.data["host"] == self.missing_tgt:
status = -2
elif event.data["url"] == self.missing_tgt:
status = -2
assert status == 1, f"NEWSLETTER Error - Expect status of 1 but got {status}"
missing = False
assert found, f"NEWSLETTER 'Found' Error - Expect status of True but got False"
assert missing, f"NEWSLETTER 'Missing' Error - Expect status of True but got False"
Loading

0 comments on commit bb7a55c

Please sign in to comment.