added integration tests
This commit is contained in:
parent
4ada46c3ba
commit
171025821d
|
@ -24,7 +24,7 @@ grep -qi "^$(escape $EMAIL)[a-zA-Z@.\ ]*$(escape $RECIPIENT)" $DATABASE 2>/dev/n
|
|||
errex "Alias \"$EMAIL $RECIPIENT\" already exists"
|
||||
|
||||
if grep -qi "^$(escape $EMAIL)" $DATABASE 2>/dev/null; then
|
||||
sed -i '' "/$EMAIL/s/$/ $RECIPIENT,/" $DATABASE
|
||||
sed -i "/$EMAIL/s/$/ $RECIPIENT,/" $DATABASE
|
||||
else
|
||||
echo "$EMAIL $RECIPIENT," >> $DATABASE
|
||||
fi
|
||||
|
|
|
@ -24,7 +24,7 @@ escape() {
|
|||
CNT=$(grep "^$EMAIL" $DATABASE | wc -w | awk '{print $1}')
|
||||
|
||||
if [[ $CNT -eq 2 ]]; then
|
||||
sed -i '' "/^$EMAIL/d" $DATABASE
|
||||
sed -i "/^$EMAIL/d" $DATABASE
|
||||
else
|
||||
sed -i '' "/^$EMAIL/s/ $RECIPIENT,//g" $DATABASE
|
||||
sed -i "/^$EMAIL/s/ $RECIPIENT,//g" $DATABASE
|
||||
fi
|
||||
|
|
|
@ -922,6 +922,36 @@ load 'test_helper/bats-assert/load'
|
|||
run value=$(cat ./config/postfix-accounts.cf | grep lorem@impsum.org)
|
||||
[ -z "$value" ]
|
||||
}
|
||||
@test "checking setup.sh: setup.sh alias list" {
|
||||
run rm ./config/postfix-virtual.cf
|
||||
run ./setup.sh -c mail alias list
|
||||
assert_failure
|
||||
}
|
||||
@test "checking setup.sh: setup.sh alias add" {
|
||||
run rm ./config/postfix-virtual.cf
|
||||
run ./setup.sh -c mail alias add test1@example.org test1@forward.com
|
||||
assert_success
|
||||
run ./setup.sh -c mail alias add test1@example.org test2@forward.com
|
||||
assert_success
|
||||
run ./setup.sh -c mail alias list
|
||||
assert_output --partial "test1@example.org test1@forward.com, test2@forward.com,"
|
||||
}
|
||||
@test "checking setup.sh: setup.sh alias del" {
|
||||
run rm ./config/postfix-virtual.cf
|
||||
run ./setup.sh -c mail alias add test1@example.org test1@forward.com
|
||||
run ./setup.sh -c mail alias add test1@example.org test2@forward.com
|
||||
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 "test1@example.org test2@forward.com,"
|
||||
|
||||
run ./setup.sh -c mail alias del test1@example.org test2@forward.com
|
||||
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
|
||||
@test "checking setup.sh: setup.sh config dkim" {
|
||||
|
|
Loading…
Reference in New Issue