]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/live_t/lp1817645-remoteauth.pg
2982d0a3dbe84950b30272444ba5317639bd89b0
[working/Evergreen.git] / Open-ILS / src / sql / Pg / live_t / lp1817645-remoteauth.pg
1 BEGIN;
2
3 SELECT plan(8);
4
5 -- test accounts:
6 -- 99999393000: not found (user does not exist)
7 -- 99999393001: expired
8 -- 99999393002: deleted
9 -- 99999393003: barred
10 -- 99999393004: valid
11 -- 99999393005: inactive
12 -- 99999393100: external
13
14 SELECT isnt_empty(
15   'SELECT * FROM config.remoteauth_profile WHERE enabled IS TRUE AND name = ''Basic''',
16   'Basic HTTP authentication is enabled'
17 );
18
19 SELECT is(
20   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393000')),
21   'not_found',
22   'Confirm remoteauth test for nonexistent patron'
23 );
24
25 SELECT is(
26   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393001')),
27   'expired',
28   'Confirm remoteauth test for expired patron'
29 );
30
31 SELECT is(
32   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393002')),
33   'not_found',
34   'Confirm remoteauth test for deleted patron'
35 );
36
37 SELECT is(
38   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393003')),
39   'blocked',
40   'Confirm remoteauth test for barred patron'
41 );
42
43 SELECT is(
44   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393004')),
45   'success',
46   'Confirm remoteauth test for valid patron'
47 );
48
49 SELECT is(
50   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393005')),
51   'blocked',
52   'Confirm remoteauth test for inactive patron'
53 );
54
55 SELECT is(
56   (SELECT * FROM actor.permit_remoteauth('Basic', (SELECT id FROM actor.usr WHERE usrname = '99999393100')),
57   'not_found',
58   'Confirm remoteauth test for external patron'
59 );
60
61 -- Finish the tests and clean up.
62 SELECT * FROM finish();
63 ROLLBACK;