From ec8198da9d1ce73f2b003a217b9af1692667d235 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Mon, 15 Aug 2016 22:36:58 +0200 Subject: [PATCH] Refactored. --- test/ENABLE_POP3.bats | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/test/ENABLE_POP3.bats b/test/ENABLE_POP3.bats index 39ebaaf8..a39ce94b 100644 --- a/test/ENABLE_POP3.bats +++ b/test/ENABLE_POP3.bats @@ -1,28 +1,19 @@ -@test "checking pop: server is ready" { - if [ $ENABLE_POP != 1 ]; then - skip - fi - 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" { - if [ $ENABLE_POP != 1 ]; then - skip - fi - 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 ] -} - - - - @test "checking pop: server is ready" { run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110 | grep '+OK'" - [ "$status" -eq 0 ] + + if [ $ENABLE_POP -eq 1 ]; then + [ "$status" -eq 0 ] + else + [ "$status" -eq 1 ] + fi } @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 ] + + if [ $ENABLE_POP -eq 1 ]; then + [ "$status" -eq 0 ] + else + [ "$status" -eq 1 ] + fi }