Skip to content

Commit

Permalink
Use %sql.fetch() and %sql.modify() in SQL xlat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ndptech committed Nov 12, 2024
1 parent 8f47a18 commit 318951c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/tests/modules/sql/xlat.unlang
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#
# Clear out old data
#
%sql("${delete_from_radcheck} 'xlat'")
%sql("${delete_from_radreply} 'xlat'")
%sql.modify("${delete_from_radcheck} 'xlat'")
%sql.modify("${delete_from_radreply} 'xlat'")

if (%sql("${insert_into_radcheck} ('%{User-Name}', 'Password.Cleartext', ':=', 'password')") != "1") {
if (%sql.modify("${insert_into_radcheck} ('%{User-Name}', 'Password.Cleartext', ':=', 'password')") != 1) {
test_fail
}

if (%sql("${insert_into_radreply} ('%{User-Name}', 'Reply-Message', ':=', '\"Hello \%{User-Name}\"')") != "1") {
if (%sql.modify("${insert_into_radreply} ('%{User-Name}', 'Reply-Message', ':=', '\"Hello \%{User-Name}\"')") != 1) {
test_fail
}

if (%sql.fetch("SELECT value FROM radcheck WHERE username = '%{User-Name}'") != 'password') {
test_fail
}

Expand Down

0 comments on commit 318951c

Please sign in to comment.