Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
smradius
smradius
Commits
62b4c897
Commit
62b4c897
authored
May 15, 2019
by
Nigel Kukard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit tests to test the attribute filtering
parent
0868c9bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
t/200-dbtests.t
t/200-dbtests.t
+32
-1
No files found.
t/200-dbtests.t
View file @
62b4c897
...
...
@@ -186,6 +186,11 @@ if ($child = fork()) {
$user1_ID
,'
Framed-IP-Address
','
:=
','
10.0.0.1
'
);
my
$user1attr3_ID
=
testDBInsert
("
Create user 'testuser1' vendor attribute '[14988:Mikrotik-Rate-Limit]'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user1_ID
,'
[14988:Mikrotik-Rate-Limit]
','
:=
','
1024k/512k
'
);
$res
=
smradius::
client
->
run
(
"
--raddb
","
dicts
",
"
127.0.0.1
",
...
...
@@ -196,8 +201,34 @@ if ($child = fork()) {
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
is
(
$res
->
{'
response
'}
->
{'
code
'},"
Access-Accept
","
Check our return is 'Access-Accept' for bare user blank '' realm
");
is
(
$res
->
{'
response
'}
->
{'
attributes
'}
->
{'
Framed-IP-Address
'},"
10.0.0.1
","
Check that an attribute is replied with if setup
");
# Test the normal attribute and vendor attribute
is
(
$res
->
{'
response
'}
->
{'
attributes
'}
->
{'
Framed-IP-Address
'},"
10.0.0.1
","
Check that attribute 'Framed-IP-Address' is
"
.
"
returned
");
is
(
$res
->
{'
response
'}
->
{'
vattributes
'}
->
{'
14988
'}
->
{'
Mikrotik-Rate-Limit
'}
->
[
0
],"
1024k/512k
","
Check that the vendor attribute
"
.
"
'14988:Mikrotik-Rate-Limit' is returned
");
# Add filter attributes
my
$user1attr4_ID
=
testDBInsert
("
Create user 'testuser1' filter attribute for 'Framed-IP-Address'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user1_ID
,'
SMRadius-Config-Filter-Reply-Attribute
','
:=
','
Framed-IP-Address
'
);
my
$user1attr5_ID
=
testDBInsert
("
Create user 'testuser1' filter vattribute for 'Mikrotik-Rate-Limit'
",
"
INSERT INTO user_attributes (UserID,Name,Operator,Value,Disabled) VALUES (?,?,?,?,0)
",
$user1_ID
,'
SMRadius-Config-Filter-Reply-VAttribute
','
:=
','
Mikrotik-Rate-Limit
'
);
$res
=
smradius::
client
->
run
(
"
--raddb
","
dicts
",
"
127.0.0.1
",
"
auth
",
"
secret123
",
'
User-Name=testuser1
',
'
User-Password=test123
',
);
is
(
ref
(
$res
),"
HASH
","
smradclient should return a HASH
");
# We shouldn't....
isnt
(
$res
->
{'
response
'}
->
{'
attributes
'}
->
{'
Framed-IP-Address
'},"
10.0.0.1
","
Check that attribute 'Framed-IP-Address' is
"
.
"
returned
");
#
# Modify data for the default realm
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment