From: Galen Charlton Date: Mon, 30 Apr 2018 20:14:52 +0000 (-0400) Subject: LP#1497322: add Perl live_t regression and unit tests for patron searching X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=28f155fe7a0def347e6b01a59d94d4780f766410;p=Evergreen.git LP#1497322: add Perl live_t regression and unit tests for patron searching Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/live_t/27-lp1497322-patron-search-by-profile.t b/Open-ILS/src/perlmods/live_t/27-lp1497322-patron-search-by-profile.t new file mode 100644 index 0000000000..b07fa5bcf7 --- /dev/null +++ b/Open-ILS/src/perlmods/live_t/27-lp1497322-patron-search-by-profile.t @@ -0,0 +1,62 @@ +#!perl +use strict; use warnings; + +use Test::More tests => 4; + +diag("Tests searching for patrons by profile"); + +use DateTime; +use OpenILS::Utils::TestUtils; +my $script = OpenILS::Utils::TestUtils->new(); +our $apputils = 'OpenILS::Application::AppUtils'; +$script->bootstrap; + +$script->authenticate({ + username => 'admin', + password => 'demo123', + type => 'staff' +}); + +ok($script->authtoken, 'Have an authtoken'); + +my $results = $apputils->simplereq( + 'open-ils.actor', + 'open-ils.actor.patron.search.advanced.fleshed.atomic', + $script->authtoken, + {"family_name" => {"value" => "smith", "group" => 0}}, + 10, + [], + undef, + 1, + ["cards"] +); + +cmp_ok(@$results, '>=', 1, 'Patron search on "Smith" returns at least one result'); + +$results = $apputils->simplereq( + 'open-ils.actor', + 'open-ils.actor.patron.search.advanced.fleshed.atomic', + $script->authtoken, + {"profile" => {"value" => 3, "group" => 0}}, + 10, + [], + undef, + 1, + ["cards"] +); + +cmp_ok(@$results, '==', 0, 'Patron search profile 3 (staff) in group 0 returns at zero results'); + +$results = $apputils->simplereq( + 'open-ils.actor', + 'open-ils.actor.patron.search.advanced.fleshed.atomic', + $script->authtoken, + {"profile" => {"value" => 3, "group" => 5}}, + 10, + [], + undef, + 1, + ["cards"] +); + +cmp_ok(@$results, '>=', 1, 'Patron search profile 3 (staff) in group 5 returns at least one result');