From dfefabd1649a644ed9972a0227be877ca98908ec Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Mon, 4 Mar 2019 16:12:45 -0800 Subject: [PATCH] LP#1817645: RemoteAuth pgTAP test Signed-off-by: Jeff Davis Signed-off-by: Galen Charlton --- .../src/sql/Pg/live_t/lp1817645-remoteauth.pg | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/live_t/lp1817645-remoteauth.pg diff --git a/Open-ILS/src/sql/Pg/live_t/lp1817645-remoteauth.pg b/Open-ILS/src/sql/Pg/live_t/lp1817645-remoteauth.pg new file mode 100644 index 0000000000..2982d0a3db --- /dev/null +++ b/Open-ILS/src/sql/Pg/live_t/lp1817645-remoteauth.pg @@ -0,0 +1,63 @@ +BEGIN; + +SELECT plan(8); + +-- test accounts: +-- 99999393000: not found (user does not exist) +-- 99999393001: expired +-- 99999393002: deleted +-- 99999393003: barred +-- 99999393004: valid +-- 99999393005: inactive +-- 99999393100: external + +SELECT isnt_empty( + 'SELECT * FROM config.remoteauth_profile WHERE enabled IS TRUE AND name = ''Basic''', + 'Basic HTTP authentication is enabled' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393000')), + 'not_found', + 'Confirm remoteauth test for nonexistent patron' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393001')), + 'expired', + 'Confirm remoteauth test for expired patron' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393002')), + 'not_found', + 'Confirm remoteauth test for deleted patron' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393003')), + 'blocked', + 'Confirm remoteauth test for barred patron' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393004')), + 'success', + 'Confirm remoteauth test for valid patron' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393005')), + 'blocked', + 'Confirm remoteauth test for inactive patron' +); + +SELECT is( + (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393100')), + 'not_found', + 'Confirm remoteauth test for external patron' +); + +-- Finish the tests and clean up. +SELECT * FROM finish(); +ROLLBACK; -- 2.43.2