Commit 7289dcf5 authored by Leonard Marschke's avatar Leonard Marschke

make tests a little bit easier

parent c24db2d8
Pipeline #6688 canceled with stages
in 1 minute and 51 seconds
......@@ -43,12 +43,12 @@ class TestSession(BaseTest):
self.assertResponse(503, b'MAIL FROM:<correct.mail@test.de>\r\n')
def test_mail_double_send(self):
self.assertResponse(250, b'EHLO localDomain\r\n')
self.assertResponse(250, b'HELO localDomain\r\n')
self.assertResponse(250, b'MAIL FROM:<correct.mail@test.de>\r\n')
self.assertResponse(503, b'MAIL FROM:<correct2.mail@test.de>\r\n')
def test_invalid_state_transition_03(self):
self.assertResponse(250, b'EHLO localhost\r\n')
self.assertResponse(250, b'HELO localhost\r\n')
self.assertResponse(250, b'MAIL FROM:<leonard@marschke.me>\r\n')
self.assertResponse(503, b'DATA\r\n')
self.assertResponse(250, b'RSET\r\n')
......@@ -57,14 +57,14 @@ class TestSession(BaseTest):
self.assertResponse(250, b'RSET\r\n')
def test_reset_operation(self):
self.assertResponse(250, b'EHLO localhost\r\n')
self.assertResponse(250, b'HELO localhost\r\n')
self.assertResponse(250, b'MAIL FROM:<leonard@marschke.me>\r\n')
self.assertResponse(250, b'RCPT TO:<firstAddress@localhost>\r\n')
self.assertResponse(250, b'RSET\r\n')
self.assertResponse(503, b'DATA\r\n')
def test_reset_operation_parameter(self):
self.assertResponse(250, b'EHLO localhost\r\n')
self.assertResponse(250, b'HELO localhost\r\n')
self.assertResponse(250, b'MAIL FROM:<leonard@marschke.me>\r\n')
self.assertResponse(250, b'RCPT TO:<firstAddress@localhost>\r\n')
self.assertResponse(250, b'RSET MAIL FROM:<leonard@marschke.me>\r\n')
......@@ -88,7 +88,13 @@ class TestSession(BaseTest):
self.assertResponse(250, b'NOOP\r\n')
def test_quit_operation(self):
pass
self.assertResponse(250, b'HELO localDomain\r\n')
self.assertResponse(221, b'QUIT\r\n')
with self.assertRaises(AssertionError):
self.assertResponse([x for x in range(500, 510)], b'NONEXISTANT\r\n')
def test_parse_helo_correct(self):
self.assertResponse(250, b'HELO marschke.me\r\n')
......
......@@ -42,15 +42,18 @@ class BaseTest(unittest.TestCase):
return message[:-2]
return message
if isinstance(expected_code, int):
expected_code = [expected_code]
if message:
if isinstance(message, str):
message = message.encode('ASCII')
self.client.send(message)
message = format_message(message)
if not expected_code:
return
if isinstance(expected_code, int):
expected_code = [expected_code]
response = ''
while not response.endswith('\r\n'):
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment