Import Debian changes 0.69.0-2
[hcoop/debian/courier-authlib.git] / debian / tests / pam
1 #!/bin/sh
2
3 # autopkgtest check: test two local users via PAM authentication.
4 # Author: Markus Wanner <markus@bluegap.ch>
5
6 set -eu
7
8 . debian/tests/common.sh
9
10 export LANG=C
11 unset LANGUAGE LC_ALL LC_CTYPE
12
13 test_enumeration() {
14 ENUM_OUTPUT="$AUTOPKGTEST_ARTIFACTS/authenumerate.out"
15
16 # test authenumerate
17 (
18 authenumerate_as_courier > $ENUM_OUTPUT 2> $AUTOPKGTEST_ARTIFACTS/authenumerate.err
19 )
20 echo $? > $AUTOPKGTEST_ARTIFACTS/authenumerate.exitcode
21
22 # the three test users should appear in the output of authenumerate
23 echo -n "checking for alice: "
24 grep "alice" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED"
25 echo -n "checking for bob: "
26 grep "bob" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED"
27 echo -n "checking for carol: "
28 grep "carol" $ENUM_OUTPUT > /dev/null && echo "ok" || echo "FAILED"
29 }
30
31 # Actual tests start here
32
33 backup_config_files
34 create_test_users
35
36 start_authdaemon
37
38 echo "== check enumeration..."
39 test_enumeration
40
41 echo "== test completed"