3 use Test::More tests => 6;
5 diag("Tests open-ils.auth.login");
7 use strict; use warnings;
8 use OpenILS::Utils::TestUtils;
9 use OpenILS::Application::AppUtils;
10 our $U = "OpenILS::Application::AppUtils";
12 OpenILS::Utils::TestUtils->new->bootstrap;
14 my $resp = $U->simplereq(
16 'open-ils.auth.login', {
18 password => 'demo123',
23 is($resp->{textcode}, 'SUCCESS', 'Admin username login OK');
25 my $authtoken = $resp->{payload}->{authtoken};
26 ok($authtoken, 'Have an authtoken');
28 $resp = $U->simplereq(
30 'open-ils.auth.session.retrieve', $authtoken);
33 (ref($resp) && !$U->event_code($resp) && $resp->usrname eq 'admin'),
34 'Able to retrieve session'
37 $resp = $U->simplereq(
39 'open-ils.auth.login', {
41 password => 'demo123x', # bad password
46 isnt($resp->{textcode}, 'SUCCESS', 'Admin bad password rejected');
48 $resp = $U->simplereq(
50 'open-ils.auth.login', {
51 barcode => '99999381970',
52 password => 'montyc1234',
57 is($resp->{textcode}, 'SUCCESS', '99999381970 login OK');
59 $resp = $U->simplereq(
61 'open-ils.auth.login', {
62 identifier => 'br1mclark',
63 password => 'montyc1234',
68 is($resp->{textcode}, 'SUCCESS', 'Identifier check for br1mclark OK');