From 28f155fe7a0def347e6b01a59d94d4780f766410 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 30 Apr 2018 16:14:52 -0400 Subject: [PATCH] LP#1497322: add Perl live_t regression and unit tests for patron searching Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- .../live_t/27-lp1497322-patron-search-by-profile.t | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Open-ILS/src/perlmods/live_t/27-lp1497322-patron-search-by-profile.t 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'); -- 2.11.0