|
@@ -16,7 +16,7 @@ def test_smtp_relay_truststore_file(host):
|
|
|
|
|
|
truststore = host.file('/etc/ssl/certs/smtp_relay_truststore.pem')
|
|
|
|
|
|
assert truststore.content == open("tests/data/x509/ca.cert.pem", "r").read().rstrip()
|
|
|
assert truststore.content_string == open("tests/data/x509/ca.cert.pem", "r").read().rstrip()
|
|
|
|
|
|
|
|
|
def test_smtp_mailname(host):
|
|
@@ -28,7 +28,7 @@ def test_smtp_mailname(host):
|
|
|
|
|
|
mailname = host.file('/etc/mailname')
|
|
|
|
|
|
assert mailname.content == "%s" % hostname
|
|
|
assert mailname.content_string == "%s" % hostname
|
|
|
|
|
|
|
|
|
def test_postfix_main_cf_file_content(host):
|
|
@@ -38,7 +38,7 @@ def test_postfix_main_cf_file_content(host):
|
|
|
|
|
|
hostname = host.run('hostname').stdout.strip()
|
|
|
config = host.file('/etc/postfix/main.cf')
|
|
|
config_lines = config.content.split("\n")
|
|
|
config_lines = config.content_string.split("\n")
|
|
|
|
|
|
assert "myhostname = %s" % hostname in config_lines
|
|
|
assert "mydestination = %s, %s, localhost.localdomain, localhost" % (hostname, hostname) in config_lines
|
|
@@ -67,8 +67,8 @@ def test_local_aliases(host):
|
|
|
pattern1 = "%s: to=<root@%s>, orig_to=<root@localhost>.*status=sent" % (message_id, hostname)
|
|
|
pattern2 = "%s: to=<testuser@%s>, orig_to=<root@localhost>.*status=sent" % (message_id, hostname)
|
|
|
|
|
|
assert re.search(pattern1, mail_log.content) is not None
|
|
|
assert re.search(pattern2, mail_log.content) is not None
|
|
|
assert re.search(pattern1, mail_log.content_string) is not None
|
|
|
assert re.search(pattern2, mail_log.content_string) is not None
|
|
|
|
|
|
|
|
|
def test_relay_mail_sending(host):
|
|
@@ -89,7 +89,7 @@ def test_relay_mail_sending(host):
|
|
|
# port.
|
|
|
pattern = r"%s: to=<root@domain1>, relay=mail-server\[[^]]*\]:27.*status=sent" % message_id
|
|
|
|
|
|
assert re.search(pattern, mail_log.content) is not None
|
|
|
assert re.search(pattern, mail_log.content_string) is not None
|
|
|
|
|
|
|
|
|
def test_tls_enforced_towards_relay_mail_server(host):
|
|
@@ -125,4 +125,4 @@ def test_tls_enforced_towards_relay_mail_server(host):
|
|
|
mail_log = host.file('/var/log/mail.log')
|
|
|
pattern = r"%s: to=<root@domain1>, relay=domain1.*status=deferred \(Server certificate not verified\)" % message_id
|
|
|
|
|
|
assert re.search(pattern, mail_log.content) is not None
|
|
|
assert re.search(pattern, mail_log.content_string) is not None
|