LP#1817645: RemoteAuth pgTAP test
authorJeff Davis <jeff.davis@bc.libraries.coop>
Tue, 5 Mar 2019 00:12:45 +0000 (16:12 -0800)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 6 Sep 2019 20:26:08 +0000 (16:26 -0400)
Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Open-ILS/src/sql/Pg/live_t/lp1817645-remoteauth.pg [new file with mode: 0644]

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 (file)
index 0000000..2982d0a
--- /dev/null
@@ -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;