From: Alan T. DeKok Date: Sun, 11 Apr 2021 11:42:17 +0000 (-0400) Subject: use macros, so the tests don't have huge lines of text X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6ce8a57156bc69a3d448759cb3292a382b65d69;p=thirdparty%2Ffreeradius-server.git use macros, so the tests don't have huge lines of text --- diff --git a/src/tests/modules/sql_sqlite/nested.unlang b/src/tests/modules/sql_sqlite/nested.unlang index f5c95219b5a..b07da1f739e 100644 --- a/src/tests/modules/sql_sqlite/nested.unlang +++ b/src/tests/modules/sql_sqlite/nested.unlang @@ -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 } diff --git a/src/tests/modules/unit_test_module.conf b/src/tests/modules/unit_test_module.conf index c28649e1e7e..0faedcde526 100644 --- a/src/tests/modules/unit_test_module.conf +++ b/src/tests/modules/unit_test_module.conf @@ -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