File: selenium

package info (click to toggle)
phpldapadmin 1.2.6.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,528 kB
  • sloc: php: 17,684; javascript: 5,299; xml: 1,498; sh: 379; python: 148; makefile: 23
file content (87 lines) | stat: -rwxr-xr-x 2,378 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh

set -eu

# Needed to find lighttpd binary and the chromedriver binary
export PATH="/sbin:/usr/sbin:/usr/bin:$PATH"

chromedriver --version

PORT=8888
DOCROOT="$AUTOPKGTEST_TMP/docroot"
CONF="$AUTOPKGTEST_TMP/lighttpd.conf"
mkdir -p "$DOCROOT"
cat >"$CONF" <<EOF
server.document-root = "$DOCROOT"
server.port = $PORT
server.modules = ( "mod_access", "mod_auth", "mod_fastcgi", "mod_alias" )
fastcgi.server += ( ".php" =>
        ((
                "bin-path" => "/usr/bin/php-cgi",
                "socket" => "$AUTOPKGTEST_TMP/php.socket"
        ))
)
# Alias for phpLDAPadmin directory
alias.url += (
	"/phpldapadmin" => "/usr/share/phpldapadmin/htdocs",
)

mimetype.assign               += ( ".php" => "application/php" )
index-file.names               = ( "index.php" )
static-file.exclude-extensions = ( ".php" )

EOF

# validate test configuration
lighttpd -tt -f "$CONF"

lighttpd -D -f "$CONF" 2>/dev/stdout &
LIGHTTPD_PID=$!

# Allow commands to fail
set +e

# Wait a bit for things to stale
sleep 1

# Copy the default config
sudo cp /usr/share/phpldapadmin/config/config.php.example /etc/phpldapadmin/config.php


LDAP_ADMIN_PASSWORD="public"
LDAP_DOMAIN="testing.local"
LDAP_ORGANISATION="Debian Testing"

cat <<EOF | sudo debconf-set-selections
slapd slapd/internal/generated_adminpw password ${LDAP_ADMIN_PASSWORD}
slapd slapd/internal/adminpw password ${LDAP_ADMIN_PASSWORD}
slapd slapd/password2 password ${LDAP_ADMIN_PASSWORD}
slapd slapd/password1 password ${LDAP_ADMIN_PASSWORD}
slapd slapd/dump_database_destdir string /var/backups/slapd-VERSION
slapd slapd/domain string ${LDAP_DOMAIN}
slapd shared/organization string ${LDAP_ORGANISATION}
slapd slapd/backend string HDB
slapd slapd/purge_database boolean true
slapd slapd/move_old_database boolean true
slapd slapd/allow_ldap_v2 boolean false
slapd slapd/no_configuration boolean false
slapd slapd/dump_database select when needed
EOF

sudo dpkg-reconfigure -f noninteractive slapd 2>&1

ldapsearch -H ldap:// -x -s base -b "" -LLL "+" | grep -F "namingContexts: dc=testing,dc=local"
ldapwhoami -D "cn=admin,dc=testing,dc=local" -w "public"

# Do tests
# Send to stdout (https://bugs.python.org/issue16164)
python3 ./debian/tests/test_phpldapadmin_web.py 2>/dev/stdout

EXIT_CODE=$?
if [ "$EXIT_CODE" -ne "0" ]; then
    echo "Tests failed !"
fi

trap 'kill "$LIGHTTPD_PID"' EXIT

exit $EXIT_CODE