summaryrefslogtreecommitdiffstats
path: root/debian/tests/rlm_python3-test
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests/rlm_python3-test')
-rw-r--r--debian/tests/rlm_python3-test43
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/tests/rlm_python3-test b/debian/tests/rlm_python3-test
new file mode 100644
index 0000000..ddf0982
--- /dev/null
+++ b/debian/tests/rlm_python3-test
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+set -e
+
+cp debian/tests/rlm_python3-data/python3.mods-available \
+ /etc/freeradius/3.0/mods-available/python3
+cp debian/tests/rlm_python3-data/python3.sites-available \
+ /etc/freeradius/3.0/sites-available/python3-test
+cp debian/tests/rlm_python3-data/ubuntu_example.py.mods-config \
+ /etc/freeradius/3.0/mods-config/python3/ubuntu_example.py
+
+# enable our python3 test site
+ln -sf /etc/freeradius/3.0/sites-available/python3-test \
+ /etc/freeradius/3.0/sites-enabled
+
+# enable the python3 module
+ln -sf /etc/freeradius/3.0/mods-available/python3 \
+ /etc/freeradius/3.0/mods-enabled
+
+# restart
+systemctl restart freeradius.service
+
+echo "Test that \"ubuntu\" can login with any password"
+result=0
+output=$(radtest ubuntu anypass$$ 127.0.0.1:1234 0 testing123) || result=$?
+if [ ${result} -ne 0 ]; then
+ echo "Failed. Output:"
+ echo "${output}"
+ exit 1
+else
+ echo "${output}" | grep "Reply-Message"
+fi
+
+echo "Test that any other user won't work"
+result=0
+output=$(radtest otheruser$$ secret$$ 127.0.0.1:1234 0 testing123 2>&1) || result=$?
+echo "${output}" | grep "Reply-Message"
+if [ ${result} -eq 0 ]; then
+ echo "This shouldn't have worked..."
+ echo "Output:"
+ echo "${output}"
+ exit 1
+fi