Refactored.

This commit is contained in:
Thomas VIAL 2016-08-16 18:07:40 +02:00
parent bec2b0ac1d
commit 80007a7b53
No known key found for this signature in database
GPG Key ID: 0394CEE552FAFEFC
4 changed files with 41 additions and 0 deletions

9
test/ENABLE_POP3_0.bats Normal file
View File

@ -0,0 +1,9 @@
@test "checking process: process is not running" {
run docker exec mail /bin/bash -c "ps aux | grep 'dovecot/pop'"
[ "$status" -eq 1 ]
}
@test "checking pop: server does not respond on port 110" {
run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110"
[ "$status" -eq 1 ]
}

14
test/ENABLE_POP3_1.bats Normal file
View File

@ -0,0 +1,14 @@
@test "checking process: process is running" {
run docker exec mail /bin/bash -c "ps aux | grep 'dovecot/pop'"
[ "$status" -eq 0 ]
}
@test "checking pop: server responds on port 110" {
run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110 | grep '+OK'"
[ "$status" -eq 0 ]
}
@test "checking pop: authentication works" {
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 110 < /tmp/docker-mailserver-test/auth/pop3-auth.txt"
[ "$status" -eq 0 ]
}

4
test/SASL_PASSWD_0.bats Normal file
View File

@ -0,0 +1,4 @@
@test "checking sasl: sasl_passwd.db should not exist" {
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
[ "$status" -eq 1 ]
}

14
test/SASL_PASSWD_1.bats Normal file
View File

@ -0,0 +1,14 @@
@test "checking sasl: doveadm auth test works with good password" {
run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld mypassword | grep 'auth succeeded'"
[ "$status" -eq 0 ]
}
@test "checking sasl: doveadm auth test fails with bad password" {
run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld BADPASSWORD | grep 'auth failed'"
[ "$status" -eq 0 ]
}
@test "checking sasl: sasl_passwd.db exists" {
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
[ "$status" -eq 0 ]
}