From: Bill Erickson Date: Tue, 15 Aug 2017 19:21:01 +0000 (-0400) Subject: LP#1710949 auth.login Perl live test script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=acefff4596478e81089a97addc102305b6bb726f;p=working%2FEvergreen.git LP#1710949 auth.login Perl live test script Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/live_t/24-lp1710949-login-api.t b/Open-ILS/src/perlmods/live_t/24-lp1710949-login-api.t new file mode 100644 index 0000000000..ba4e4dfc4a --- /dev/null +++ b/Open-ILS/src/perlmods/live_t/24-lp1710949-login-api.t @@ -0,0 +1,69 @@ +#!perl + +use Test::More tests => 6; + +diag("Tests open-ils.auth.login"); + +use strict; use warnings; +use OpenILS::Utils::TestUtils; +use OpenILS::Application::AppUtils; +our $U = "OpenILS::Application::AppUtils"; + +OpenILS::Utils::TestUtils->new->bootstrap; + +my $resp = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.login', { + username => 'admin', + password => 'demo123', + type => 'staff' + } +); + +is($resp->{textcode}, 'SUCCESS', 'Admin username login OK'); + +my $authtoken = $resp->{payload}->{authtoken}; +ok($authtoken, 'Have an authtoken'); + +$resp = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.session.retrieve', $authtoken); + +ok( + (ref($resp) && !$U->event_code($resp) && $resp->usrname eq 'admin'), + 'Able to retrieve session' +); + +$resp = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.login', { + username => 'admin', + password => 'demo123x', # bad password + type => 'staff' + } +); + +isnt($resp->{textcode}, 'SUCCESS', 'Admin bad password rejected'); + +$resp = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.login', { + barcode => '99999381970', + password => 'montyc1234', + type => 'staff' + } +); + +is($resp->{textcode}, 'SUCCESS', '99999381970 login OK'); + +$resp = $U->simplereq( + 'open-ils.auth', + 'open-ils.auth.login', { + identifier => 'br1mclark', + password => 'montyc1234', + type => 'staff' + } +); + +is($resp->{textcode}, 'SUCCESS', 'Identifier check for br1mclark OK'); +