From 3bc96cf97f88aa07b6373dbd2c8bf6714b255dd8 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 15 Aug 2017 15:21:01 -0400 Subject: [PATCH] LP#1710949 auth.login Perl live test script Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- .../perlmods/live_t/24-lp1710949-login-api.t | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Open-ILS/src/perlmods/live_t/24-lp1710949-login-api.t 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'); + -- 2.43.2