Commit b861e178 authored by Pawel Boening's avatar Pawel Boening

tests ready

parent cb2ea661
Pipeline #6581 failed with stage
in 6 minutes and 1 second
......@@ -292,88 +292,60 @@ class TestConnection(unittest.TestCase):
# TODO:
#def test_post_invalid_parameter_stability_0(self):
#self.send(b'EHLO localhost\r\n')
#self.assertCodeResponse(b'250', check_line_number=False)
#self.send(b'MAIL wrong input blabla\r\n')
#self.assertCodeResponse(b'500')
#self.send(b'MAIL FROM:<correct.mail@test.de>\r\n')
#self.assertCodeResponse(b'250')
#def test_post_invalid_parameter_stability_1(self):
#self.send(b'EHLO localhost\r\n')
#self.assertCodeResponse(b'250', check_line_number=False)
#self.send(b'MAIL FROM:<correct.mail@test.de>\r\n')
#self.assertCodeResponse(b'250')
#self.send(b'RCPT wrong input blabla\r\n')
#self.assertCodeResponse(b'500')
#self.send(b'RCPT TO:<correct@server.test>\r\n')
#self.assertCodeResponse(b'250')
#def test_mail_save(self):
#self.send(b'HELO localDomain\r\n')
#self.assertCodeResponse(b'250')
#self.send(b'MAIL FROM:<user0@test.de>\r\n')
#self.assertCodeResponse(b'250')
#self.send(b'RCPT TO:<user1@server.test>\r\n')
#self.assertCodeResponse(b'250')
#self.send(b'RCPT TO:<user2@server.test>\r\n')
#self.assertCodeResponse(b'250')
#self.send(b'DATA\r\n')
#self.assertCodeResponse(b'354')
#self.send(b'text text\r\n')
#self.send(b'text text\r\n')
#self.send(b'.\r\n')
#self.assertCodeResponse(b'250')
#self.assertTrue(os.path.exists('./mailbox/user1/0.txt'))
#self.assertTrue(os.path.exists('./mailbox/user2/0.txt'))
#with open('./mailbox/user1/0.txt') as file:
#readcontent = file.read()
#mailcontent = """FROM: user0@test.de\nTO: user1@server.test\nDATA:\ntext text\ntext text\n"""
#self.assertTrue(readcontent == mailcontent)
#with open('./mailbox/user2/0.txt') as file:
#readcontent = file.read()
#mailcontent = """FROM: user0@test.de\nTO: user2@server.test\nDATA:\ntext text\ntext text\n"""
#self.assertTrue(readcontent == mailcontent)
#def test_help(self):
#self.send(b'HELP\r\n')
#self.assertCodeResponse(b'250')
#def test_helo(self):
#self.send(b'HELO localDomain\r\n')
#self.assertCodeResponse(b'250')
#def test_helo_no_domain(self):
#self.send(b'HELO\r\n')
#self.assertCodeResponse(b'501')
#def test_ehlo(self):
#self.send(b'EHLO localDomain\r\n')
#self.assertCodeResponse(b'250', check_line_number=False)
#def test_ehlo_no_domain(self):
#self.send(b'EHLO\r\n')
#self.assertCodeResponse(b'501')
#def test_mail_no_ehlo(self):
#self.send(b'MAIL FROM:<correct.mail@test.de>\r\n')
#self.assertCodeResponse(b'503')
#def test_mail_double_send(self):
#self.send(b'EHLO localDomain\r\n')
#self.assertCodeResponse(b'250', check_line_number=False)
#self.send(b'MAIL FROM:<correct.mail@test.de>\r\n')
#self.assertCodeResponse(b'250')
#self.send(b'MAIL FROM:<correct2.mail@test.de>\r\n')
#self.assertCodeResponse(b'503')
def test_post_invalid_parameter_stability_0(self):
self.assertResponse(250, b'EHLO localhost\r\n')
self.assertResponse(500, b'MAIL wrong input blabla\r\n')
self.assertResponse(250, b'MAIL FROM:<correct.mail@test.de>\r\n')
def test_post_invalid_parameter_stability_1(self):
self.assertResponse(250, b'EHLO localhost\r\n')
self.assertResponse(250, b'MAIL FROM:<correct.mail@test.de>\r\n')
self.assertResponse(500, b'RCPT wrong input blabla\r\n')
self.assertResponse(250, b'RCPT TO:<correct@localhost>\r\n')
def test_help(self):
self.assertResponse(250, b'HELP\r\n')
def test_helo(self):
self.assertResponse(250, b'HELO localDomain\r\n')
def test_helo_dot(self):
self.assertResponse(250, b'HELO localDomain.de\r\n')
def test_helo_no_domain(self):
self.assertResponse(501, b'HELO\r\n')
def test_ehlo(self):
self.assertResponse(250, b'EHLO localDomain\r\n')
def test_ehlo(self):
self.assertResponse(250, b'EHLO localDomain.de\r\n')
def test_ehlo_no_domain(self):
self.assertResponse(501, b'EHLO\r\n')
def test_mail_no_ehlo(self):
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'MAIL FROM:<correct.mail@test.de>\r\n')
self.assertResponse(503, b'MAIL FROM:<correct2.mail@test.de>\r\n')
def test_mail_save(self):
self.assertResponse(250, b'HELO localDomain\r\n')
self.assertResponse(250, b'MAIL FROM:<user0@test.de>\r\n')
self.assertResponse(250, b'RCPT TO:<user1@localhost>\r\n')
self.assertResponse(250, b'RCPT TO:<user2@localhost>\r\n')
self.assertResponse(354, b'DATA\r\n')
self.client.send(b'SOME_RANDOM_TEXT\r\n')
self.client.send(b'SOME_RANDOM_TEXT\r\n')
self.assertResponse(250, b'.\r\n')
mail_location = subprocess.check_output(['sudo',
'docker',
'exec',
'{}'.format(self.test_server.docker_id.decode('utf-8')),
'grep',
'-r',
'SOME_RANDOM_TEXT'])
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