]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use macros, so the tests don't have huge lines of text
authorAlan T. DeKok <aland@freeradius.org>
Sun, 11 Apr 2021 11:42:17 +0000 (07:42 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 12 Apr 2021 21:28:16 +0000 (17:28 -0400)
src/tests/modules/sql_sqlite/nested.unlang
src/tests/modules/unit_test_module.conf

index f5c95219b5a1e4d1e5bacd7f9c7afb61165091b5..b07da1f739e426c690a2058848603d3f3537fc25 100644 (file)
@@ -1,41 +1,41 @@
 #
 #  Clear out old data.  We don't care if the deletion deletes any rows.
 #
-"%{sql:DELETE FROM radcheck WHERE username = 'user_auth_nested'}"
-"%{sql:DELETE FROM radreply WHERE username = 'user_auth_nested'}"
+"%{sql:${delete_from_radcheck} 'user_auth_nested'}"
+"%{sql:${delete_from_radreply} 'user_auth_nested'}"
 
 #
 #  Add in the check items.
 #
-if ("%{sql:INSERT INTO radcheck (username, attribute, op, value) VALUES ('user_auth_nested', 'NAS-IP-Address', '==', '1.2.3.4')}" != "1") {
+if ("%{sql:${insert_into_radcheck} ('user_auth_nested', 'NAS-IP-Address', '==', '1.2.3.4')}" != "1") {
        test_fail
 }
 
-if ("%{sql:INSERT INTO radcheck (username, attribute, op, value) VALUES ('user_auth_nested', 'Password.Cleartext', ':=', 'password')}" != "1") {
+if ("%{sql:${insert_into_radcheck} ('user_auth_nested', 'Password.Cleartext', ':=', 'password')}" != "1") {
        test_fail
 }
 
 #
 #  Add in the reply items.
 #
-if ("%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_auth_nested', 'Idle-Timeout', ':=', '3600')}" != "1") {
+if ("%{sql:${insert_into_radreply} ('user_auth_nested', 'Idle-Timeout', ':=', '3600')}" != "1") {
        test_fail
 }
 
-if ("%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_auth_nested', 'Digest-Attributes', ':=', '')}" != "1") {
+if ("%{sql:${insert_into_radreply} ('user_auth_nested', 'Digest-Attributes', ':=', '')}" != "1") {
        test_fail
 }
 
 
-if ("%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_auth_nested', '.Nonce', ':=', 'dcd98b7102dd2f0e8b11d0f600bfb0c093')}" != "1") {
+if ("%{sql:${insert_into_radreply} ('user_auth_nested', '.Nonce', ':=', 'dcd98b7102dd2f0e8b11d0f600bfb0c093')}" != "1") {
        test_fail
 }
 
-if ("%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_auth_nested', '.Method', ':=', 'Invite')}" != "1") {
+if ("%{sql:${insert_into_radreply} ('user_auth_nested', '.Method', ':=', 'Invite')}" != "1") {
        test_fail
 }
 
-if ("%{sql:INSERT INTO radreply (username, attribute, op, value) VALUES ('user_auth_nested', '.URI', ':=', 'sip:bob@biloxi.com')}" != "1") {
+if ("%{sql:${insert_into_radreply} ('user_auth_nested', '.URI', ':=', 'sip:bob@biloxi.com')}" != "1") {
        test_fail
 }
 
index c28649e1e7e05f58215bffa30b0d755206878d50..0faedcde526eea6327f147c63c3d2b39f593ac22 100644 (file)
@@ -12,6 +12,11 @@ security {
        allow_vulnerable_openssl = yes
 }
 
+delete_from_radcheck = "DELETE FROM radcheck WHERE username ="
+delete_from_radreply = "DELETE FROM radreply WHERE username ="
+insert_into_radcheck = "INSERT INTO radcheck (username, attribute, op, value) VALUES"
+insert_into_radreply = "INSERT INTO radreply (username, attribute, op, value) VALUES"
+
 modules {
        $INCLUDE ${raddb}/mods-enabled/always