From: Guillaume Pannatier Date: Thu, 5 May 2016 07:34:53 +0000 (+0200) Subject: Use radiusd constants for the returns and comment rlm_python tests X-Git-Tag: branch_3_1_x~403^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fcec6c9ffccd5151431bf57083b331ce0aa90e6;p=thirdparty%2Ffreeradius-server.git Use radiusd constants for the returns and comment rlm_python tests --- diff --git a/src/tests/modules/python/auth_cext_compat.unlang b/src/tests/modules/python/auth_cext_compat.unlang index d6740550399..f055bda9265 100644 --- a/src/tests/modules/python/auth_cext_compat.unlang +++ b/src/tests/modules/python/auth_cext_compat.unlang @@ -1,4 +1,5 @@ -pmod2 +# This module is cext_compat and should work +pmod4_cextcompat if (!ok) { test_fail } else { diff --git a/src/tests/modules/python/auth_multi_inst.unlang b/src/tests/modules/python/auth_multi_inst.unlang index 8e23fc8db0c..56669269e0e 100644 --- a/src/tests/modules/python/auth_multi_inst.unlang +++ b/src/tests/modules/python/auth_multi_inst.unlang @@ -1,3 +1,4 @@ +# Call the second configured module firstly should work pmod2 if (!ok) { test_fail @@ -5,6 +6,7 @@ if (!ok) { test_pass } +# Call the first configured module secondly pmod1 if (!noop) { test_fail diff --git a/src/tests/modules/python/auth_with_tls.unlang b/src/tests/modules/python/auth_with_tls.unlang index 3d0e6238aa8..8baaac399d2 100644 --- a/src/tests/modules/python/auth_with_tls.unlang +++ b/src/tests/modules/python/auth_with_tls.unlang @@ -1,3 +1,4 @@ +# The first call on pmod1 should store var "tls" in a thread local storage and return noop pmod1 if (!noop) { test_fail @@ -5,6 +6,7 @@ if (!noop) { test_pass } +# Simply call another second module pmod2 if (!ok) { test_fail @@ -12,6 +14,7 @@ if (!ok) { test_pass } +# The second call on pmod1 should return OK because "tls" is set pmod1 if (!ok) { test_fail @@ -19,6 +22,7 @@ if (!ok) { test_pass } +# Calling another python module configured with mod1.py should be in it's own context and return NOOP on first call pmod3_withmod1 if (!noop) { test_fail @@ -26,20 +30,7 @@ if (!noop) { test_pass } -pmod3_withmod1 -if (!ok) { - test_fail -} else { - test_pass -} - -pmod3_withmod1 -if (!ok) { - test_fail -} else { - test_pass -} - +# Should return "OK" on subsequent calls pmod3_withmod1 if (!ok) { test_fail diff --git a/src/tests/modules/python/mod1.py b/src/tests/modules/python/mod1.py index ddb4f8c24b2..f2b2a5faa01 100644 --- a/src/tests/modules/python/mod1.py +++ b/src/tests/modules/python/mod1.py @@ -1,3 +1,4 @@ +import radiusd import threading local = threading.local() @@ -5,7 +6,7 @@ local = threading.local() def authorize(p): global local if hasattr(local, 'tls'): - return 2 + return radiusd.RLM_MODULE_OK else: local.tls = True - return 7 \ No newline at end of file + return radiusd.RLM_MODULE_NOOP \ No newline at end of file diff --git a/src/tests/modules/python/mod2.py b/src/tests/modules/python/mod2.py index db9d6d69075..9089d1aa7fb 100644 --- a/src/tests/modules/python/mod2.py +++ b/src/tests/modules/python/mod2.py @@ -1,2 +1,4 @@ +import radiusd + def authorize(p): - return 2 \ No newline at end of file + return radiusd.RLM_MODULE_OK \ No newline at end of file