Refactored.

This commit is contained in:
Thomas VIAL 2016-08-15 23:17:49 +02:00
parent 21ed11b5b6
commit ce4c2059bb
No known key found for this signature in database
GPG Key ID: 0394CEE552FAFEFC
3 changed files with 33 additions and 23 deletions

View File

@ -59,6 +59,10 @@ ifdef ENABLE_POP3
@echo "ENABLE_POP3 => $(ENABLE_POP3)"
./test/bats/bats test/ENABLE_POP3.bats
endif
ifdef SASL_PASSWD
@echo "SASL_PASSWD => $(SASL_PASSWD)"
./test/bats/bats test/SASL_PASSWD.bats
endif
clean:
# Remove running test container

29
test/SASL_PASSWD.bats Normal file
View File

@ -0,0 +1,29 @@
@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'"
if [ -n "$SASL_PASSWD" ]; then
[ "$status" -eq 0 ]
else
[ "$status" -eq 1 ]
fi
}
@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'"
if [ -n "$SASL_PASSWD" ]; then
[ "$status" -eq 0 ]
else
[ "$status" -eq 1 ]
fi
}
@test "checking sasl: sasl_passwd.db exists" {
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
if [ -n "$SASL_PASSWD" ]; then
[ "$status" -eq 0 ]
else
[ "$status" -eq 1 ]
fi
}

View File

@ -84,29 +84,6 @@ fi
[ "$status" -eq 0 ]
}
#
# sasl
#
if [ $SASL_PASSWD == "external-domain.com username:password" ]; then
@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 ]
}
fi
#
# logs
#