From aa938397f56bceae60b3dd3eff0b5d851df9e080 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Tue, 23 Apr 2019 15:57:19 +0200 Subject: [PATCH] some minor correction to last user_is test --- test/ALL-tests.sh | 6 +++--- test/d-user_is-test.sh | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/ALL-tests.sh b/test/ALL-tests.sh index ab797a6..c6eea8b 100755 --- a/test/ALL-tests.sh +++ b/test/ALL-tests.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # this has to run once atfer git clone # and every time we create new hooks -#### $$VERSION$$ v0.70-dev2-10-gfa9e879 +#### $$VERSION$$ v0.70-dev2-11-g8549727 # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script @@ -45,8 +45,8 @@ if [ "$fail" -eq 0 ]; then else /bin/echo -n 'FAILURE ' exitcode=1 - #rm -rf "${TESTENV}/test" - #find "${TESTENV}/"* ! -name '[a-z]-*' -delete + rm -rf "${TESTENV}/test" + find "${TESTENV}/"* ! -name '[a-z]-*' -delete fi echo "${passed} / ${tests}" diff --git a/test/d-user_is-test.sh b/test/d-user_is-test.sh index 23a4c11..a6e2bc8 100755 --- a/test/d-user_is-test.sh +++ b/test/d-user_is-test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.70-dev2-10-gfa9e879 +#### $$VERSION$$ v0.70-dev2-11-g8549727 # include common functions and definitions # shellcheck source=test/ALL-tests.inc.sh @@ -17,9 +17,10 @@ source "${TESTDIR}/bashbot.sh" source # first user asking for botadmin will botadmin echo " test \"user_is_botadmin\" ..." -echo '?' >"${ADMINFILE}" # auto mode -user_is_botadmin "BOTADMIN" || exit 1 # should never fail +echo '?' >"${ADMINFILE}" # auto mode + +user_is_botadmin "BOTADMIN" || exit 1 # should never fail user_is_botadmin "NOBOTADMIN" && exit 1 # should fail user_is_botadmin "BOTADMIN" || exit 1 # same name as first one, should work @@ -32,24 +33,25 @@ echo "${SUCCESS}" # lets see If UAC works ... echo " test \"user_is_allowed\" ..." + echo " ... with not rules" -user_is_allowed "NOBOTADMIN" "ANYTHING" && exit 1 # should always fail because not rules exist +user_is_allowed "NOBOTADMIN" "ANYTHING" && exit 1 # should always fail because no rules exist user_is_allowed "BOTADMIN" "ANYTHING" && exit 1 # should fail even is BOTADMIN echo "${SUCCESS}" echo " ... with BOTADMIN:*:*" echo 'BOTADMIN:*:*' >"${ACLFILE}" # RULE allow BOTADMIN everything -user_is_allowed "BOTADMIN" "ANYTHING" || exit 1 # should always work +user_is_allowed "BOTADMIN" "ANYTHING" || exit 1 # should work now user_is_allowed "NOBOTADMIN" "ANYTHING" && exit 1 # should fail because user is not listed echo "${SUCCESS}" echo " ... with NOBOTAMIN:SOMETHING:*" echo 'NOBOTADMIN:SOMETHING:*' >>"${ACLFILE}" # RULE allow NOBOTADMIN something -user_is_allowed "BOTADMIN" "ANYTHING" || exit 1 # should always work -user_is_allowed "BOTADMIN" "SOMETHING" || exit 1 # should always work -user_is_allowed "NOBOTADMIN" "SOMETHING" || exit 1 # should work +user_is_allowed "BOTADMIN" "ANYTHING" || exit 1 # should work +user_is_allowed "BOTADMIN" "SOMETHING" || exit 1 # should work +user_is_allowed "NOBOTADMIN" "SOMETHING" || exit 1 # should work now user_is_allowed "NOBOTADMIN" "ANYTHING" && exit 1 # should fail because only SOMETHING is listed echo "${SUCCESS}"