X-Git-Url: https://git.hcoop.net/hcoop/debian/courier-authlib.git/blobdiff_plain/1420868b3e321353480efbb7eb35e1e8d9943223..463a5c942956f42fce366796356201639cb0d92b:/debian/tests/pam diff --git a/debian/tests/pam b/debian/tests/pam new file mode 100755 index 0000000..055d45a --- /dev/null +++ b/debian/tests/pam @@ -0,0 +1,41 @@ +#!/bin/sh + +# autopkgtest check: test two local users via PAM authentication. +# Author: Markus Wanner + +set -eu + +. debian/tests/common.sh + +export LANG=C +unset LANGUAGE LC_ALL LC_CTYPE + +test_enumeration() { + ENUM_OUTPUT="$AUTOPKGTEST_ARTIFACTS/authenumerate.out" + + # test authenumerate + ( + authenumerate_as_courier > $ENUM_OUTPUT 2> $AUTOPKGTEST_ARTIFACTS/authenumerate.err + ) + echo $? > $AUTOPKGTEST_ARTIFACTS/authenumerate.exitcode + + # the three test users should appear in the output of authenumerate + echo -n "checking for alice: " + grep "alice" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED" + echo -n "checking for bob: " + grep "bob" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED" + echo -n "checking for carol: " + grep "carol" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED" +} + +# Actual tests start here + +backup_config_files +create_test_users + +start_authdaemon + +echo "== check enumeration..." +test_enumeration + +echo "== test completed"