Skip to content

Commit

Permalink
Test python module instance configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
gyx1000 committed May 5, 2016
1 parent 8ef1245 commit d419e1f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/tests/modules/python/auth_configured_module.attrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Input packet
#
User-Name = "bob"
User-Password = "hello"

#
# Expected answer
#
Response-Packet-Type == Access-Accept
6 changes: 6 additions & 0 deletions src/tests/modules/python/auth_configured_module.unlang
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pmod6_configured
if (!ok) {
test_fail
} else {
test_pass
}
7 changes: 7 additions & 0 deletions src/tests/modules/python/mod4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import radiusd

def authorize(p):
if radiusd.config.get('a_param'):
return radiusd.RLM_MODULE_OK

return radiusd.RLM_MODULE_NOOP
11 changes: 11 additions & 0 deletions src/tests/modules/python/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,15 @@ python pmod5_not_cextcompat {
func_authorize = authorize

cext_compat = false
}

python pmod6_configured {
module = 'mod4'

mod_authorize = ${.module}
func_authorize = authorize

config {
a_param = "a_value"
}
}

0 comments on commit d419e1f

Please sign in to comment.