tests for aliases should be working now

This commit is contained in:
Thomas A. Kilian 2017-04-15 17:08:50 +02:00
parent f6c78839f1
commit 177719b756
No known key found for this signature in database
GPG Key ID: 6403AD7CD724D228
1 changed files with 12 additions and 22 deletions

View File

@ -916,43 +916,33 @@ load 'test_helper/bats-assert/load'
fi fi
assert_success assert_success
} }
# alias
@test "checking setup.sh: setup.sh email del" { @test "checking setup.sh: setup.sh email del" {
run ./setup.sh -c mail email del lorem@impsum.org run ./setup.sh -c mail email del lorem@impsum.org
assert_success assert_success
run value=$(cat ./config/postfix-accounts.cf | grep lorem@impsum.org) run value=$(cat ./config/postfix-accounts.cf | grep lorem@impsum.org)
[ -z "$value" ] [ -z "$value" ]
} }
# alias
@test "checking setup.sh: setup.sh alias list" { @test "checking setup.sh: setup.sh alias list" {
run rm ./config/postfix-virtual.cf echo "test@example.org test@forward.com" > ./config/postfix-virtual.cf
run ./setup.sh -c mail alias list run ./setup.sh -c mail alias list
assert_failure assert_success
} }
@test "checking setup.sh: setup.sh alias add" { @test "checking setup.sh: setup.sh alias add" {
run rm ./config/postfix-virtual.cf echo "" > ./config/postfix-virtual.cf
run ./setup.sh -c mail alias add test1@example.org test1@forward.com ./setup.sh -c mail alias add test1@example.org test1@forward.com
./setup.sh -c mail alias add test1@example.org test2@forward.com
run /bin/sh -c 'cat ./config/postfix-virtual.cf | grep "test1@example.org test1@forward.com, test2@forward.com," | wc -l | grep 1'
assert_success assert_success
run ./setup.sh -c mail alias add test1@example.org test2@forward.com
assert_success
value=$(cat ./config/postfix-virtual.cf)
[ "$value" == "test1@example.org test1@forward.com, test2@forward.com," ]
} }
@test "checking setup.sh: setup.sh alias del" { @test "checking setup.sh: setup.sh alias del" {
rm ./config/postfix-virtual.cf
echo 'test1@example.org test1@forward.com, test2@forward.com,' > ./config/postfix-virtual.cf echo 'test1@example.org test1@forward.com, test2@forward.com,' > ./config/postfix-virtual.cf
run ./setup.sh -c mail alias del test1@example.org test1@forward.com ./setup.sh -c mail alias del test1@example.org test1@forward.com
./setup.sh -c mail alias del test1@example.org test2@forward.com
run cat ./config/postfix-virtual.cf | wc -l | grep 0
assert_success assert_success
value=$(cat ./config/postfix-virtual.cf)
[ "$value" == "test1@example.org test2@forward.com," ]
}
@test "checking setup.sh: setup.sh alias del (last alias)" {
run ./setup.sh -c mail alias del test1@example.org test2@forward.com
assert_success
run ./setup.sh -c mail alias del test1@example.org test1@forward.com
assert_success
run ./setup.sh -c mail alias list
assert_output --partial "Empty postfix-virtual.cf"
} }
# config # config