Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
giga-a authored Sep 12, 2024
1 parent 83df0c3 commit d53683d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions tests/test_smtp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
},
}
}
EXPECTED_DATA = [
{"arg": "FROM:<fromtest>", "command": "mail", "data": "None"},
{"arg": "TO:<totest>", "command": "rcpt", "data": "None"},
{"arg": "None", "command": "data", "data": "None"},
{"arg": "None", "command": "Nothing", "data": "None"},
{"arg": "None", "command": "quit", "data": "None"},
]


@pytest.mark.parametrize(
Expand All @@ -43,19 +36,15 @@ def test_smtp_server(server_logs):
client = SMTP(IP, int(PORT))
client.ehlo()
client.login(USERNAME, PASSWORD)
client.sendmail("fromtest", "totest", "Nothing")
client.quit()

logs = load_logs_from_file(server_logs)

assert len(logs) == 9
connect1, connect2, auth, login, *additional = logs
assert len(logs) == 4
connect1, auth, login, *additional = logs
assert_connect_is_logged(connect1, PORT)
assert_connect_is_logged(connect2, PORT)
assert_login_is_logged(login)

assert auth["data"]["command"] == "AUTH"
assert b64decode(auth["data"]["data"]).decode() == f"\x00{USERNAME}\x00{PASSWORD}"

for entry, expected in zip(additional, EXPECTED_DATA):
assert entry["data"] == expected

0 comments on commit d53683d

Please sign in to comment.