[open-ils-commits] [GIT] Evergreen ILS branch master updated. 913237b92bcd9278cd3608ad4d6d1048bda1d1d0
Evergreen Git
git at git.evergreen-ils.org
Wed Aug 8 15:51:42 EDT 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 913237b92bcd9278cd3608ad4d6d1048bda1d1d0 (commit)
from 536e5e8cd2a4c753c2a13e001d9d906fe57022a9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 913237b92bcd9278cd3608ad4d6d1048bda1d1d0
Author: Jason Stephenson <jason at sigio.com>
Date: Sun Jul 8 14:19:10 2018 -0400
LP 1780660: Add more workstation functions to OpenILS::Utils::TestUtils.
Add methods find_or_register_workstation($name, $lib) and
find_workstation($name, $lib) to OpenILS::Utils::TestUtils. These can
be used when writing tests or other scripts to find or create
workstations.
The following Perl live tests were updated to use the new methods
rather than their hand-rolled versions:
* 14-lp1499123_csp_ignore_proximity.t
* 18-lp1592891_sip_standing_penalties.t
* 19-lp1306666-abort-transit-copy-status.t
* 25-lp1694058-multiple-hold-placement.t
Testing this is very simple:
1. Install Evergreen from this branch.
2. Load the Concerto dataset.
3. Start Evergreen services with osrf_control.
4. cd to the perlmods source directory.
5. Do 'make livecheck' and see that all tests pass, particularly the 4
mentioned above.
Signed-off-by: Jason Stephenson <jason at sigio.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/TestUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/TestUtils.pm
index 443857c..6d66790 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/TestUtils.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/TestUtils.pm
@@ -8,6 +8,20 @@ use strict; use warnings;
my $apputils = 'OpenILS::Application::AppUtils';
+sub find_workstation {
+ my ($self,$name,$lib) = (shift,shift,shift);
+ my $resp = $apputils->simplereq(
+ 'open-ils.actor',
+ 'open-ils.actor.workstation.list',
+ $self->authtoken,
+ $lib
+ );
+ if ($resp->{$lib}) {
+ return scalar(grep {$_->name() eq $name} @{$resp->{$lib}});
+ }
+ return 0;
+}
+
sub register_workstation {
my ($self,$name,$lib) = (shift,shift,shift);
my $resp = $apputils->simplereq(
@@ -17,6 +31,15 @@ sub register_workstation {
return $resp;
}
+sub find_or_register_workstation {
+ my ($self,$name,$lib) = (shift,shift,shift);
+ my $workstation = $self->find_workstation($name, $lib);
+ if (!$workstation) {
+ $workstation = $self->register_workstation($name, $lib);
+ }
+ return $workstation;
+}
+
sub do_checkout {
my ($self,$args) = (shift,shift);
my $resp = $apputils->simplereq(
diff --git a/Open-ILS/src/perlmods/live_t/14-lp1499123_csp_ignore_proximity.t b/Open-ILS/src/perlmods/live_t/14-lp1499123_csp_ignore_proximity.t
index 2b993bc..709fcb0 100644
--- a/Open-ILS/src/perlmods/live_t/14-lp1499123_csp_ignore_proximity.t
+++ b/Open-ILS/src/perlmods/live_t/14-lp1499123_csp_ignore_proximity.t
@@ -14,21 +14,6 @@ our $apputils = 'OpenILS::Application::AppUtils';
use constant WORKSTATION_NAME => 'BR1-test-lp1499123_csp_ignore_proximity.t';
use constant WORKSTATION_LIB => 4;
-# Because this may run multiple times, without a DB reload, we search
-# for the workstation before registering it.
-sub find_workstation {
- my $r = $apputils->simplereq(
- 'open-ils.actor',
- 'open-ils.actor.workstation.list',
- $script->authtoken,
- WORKSTATION_LIB
- );
- if ($r->{&WORKSTATION_LIB}) {
- return scalar(grep {$_->name() eq WORKSTATION_NAME} @{$r->{&WORKSTATION_LIB}});
- }
- return 0;
-}
-
sub retrieve_staff_chr {
my $e = shift;
my $staff_chr = $e->retrieve_config_standing_penalty(25);
@@ -158,7 +143,7 @@ $script->authenticate({
ok($script->authtoken, 'Initial Login');
SKIP: {
- my $ws = find_workstation();
+ my $ws = $script->find_workstation(WORKSTATION_NAME, WORKSTATION_LIB);
skip 'Workstation exists', 1 if ($ws);
$ws = $script->register_workstation(WORKSTATION_NAME, WORKSTATION_LIB) unless ($ws);
ok(! ref $ws, 'Registered a new workstation');
diff --git a/Open-ILS/src/perlmods/live_t/18-lp1592891_sip_standing_penalties.t b/Open-ILS/src/perlmods/live_t/18-lp1592891_sip_standing_penalties.t
index bf695bc..ca8754e 100644
--- a/Open-ILS/src/perlmods/live_t/18-lp1592891_sip_standing_penalties.t
+++ b/Open-ILS/src/perlmods/live_t/18-lp1592891_sip_standing_penalties.t
@@ -18,21 +18,6 @@ our $apputils = 'OpenILS::Application::AppUtils';
use constant WORKSTATION_NAME => 'BR1-test-lp1592891_sip_standing_penalties.t';
use constant WORKSTATION_LIB => 4;
-# Because this may run multiple times, without a DB reload, we search
-# for the workstation before registering it.
-sub find_workstation {
- my $r = $apputils->simplereq(
- 'open-ils.actor',
- 'open-ils.actor.workstation.list',
- $script->authtoken,
- WORKSTATION_LIB
- );
- if ($r->{&WORKSTATION_LIB}) {
- return scalar(grep {$_->name() eq WORKSTATION_NAME} @{$r->{&WORKSTATION_LIB}});
- }
- return 0;
-}
-
sub retrieve_penalty {
my $e = shift;
my $penalty = shift;
@@ -124,7 +109,7 @@ $script->authenticate({
ok($script->authtoken, 'Initial Login');
SKIP: {
- my $ws = find_workstation();
+ my $ws = $script->find_workstation(WORKSTATION_NAME, WORKSTATION_LIB);
skip 'Workstation exists', 1 if ($ws);
$ws = $script->register_workstation(WORKSTATION_NAME, WORKSTATION_LIB) unless ($ws);
ok(! ref $ws, 'Registered a new workstation');
diff --git a/Open-ILS/src/perlmods/live_t/19-lp1306666-abort-transit-copy-status.t b/Open-ILS/src/perlmods/live_t/19-lp1306666-abort-transit-copy-status.t
index 699716c..470ca2b 100644
--- a/Open-ILS/src/perlmods/live_t/19-lp1306666-abort-transit-copy-status.t
+++ b/Open-ILS/src/perlmods/live_t/19-lp1306666-abort-transit-copy-status.t
@@ -18,23 +18,6 @@ use constant {
CBARCODE => 'CONC4000036'
};
-# Because this may run multiple times, without a DB reload, we search
-# for the workstation before registering it. Takes an authtoken, the
-# id of the workstation lib, and the name of the workstation.
-sub find_workstation {
- my ($authtoken, $lib, $workstation) = @_;
- my $r = $apputils->simplereq(
- 'open-ils.actor',
- 'open-ils.actor.workstation.list',
- $authtoken,
- $lib
- );
- if ($r->{$lib}) {
- return scalar(grep {$_->name() eq $workstation} @{$r->{$lib}});
- }
- return 0;
-}
-
# Store authtokens
my @authtoken = ();
@@ -46,7 +29,7 @@ $authtoken[0] = $script->authenticate({
});
# Register workstation at BR1.
-unless (find_workstation($authtoken[0], BR1_ID, BR1_WORKSTATION)) {
+unless ($script->find_workstation(BR1_WORKSTATION, BR1_ID)) {
$script->register_workstation(BR1_WORKSTATION, BR1_ID);
}
@@ -69,7 +52,7 @@ $authtoken[1] = $script->authenticate({
});
# Register workstation at BR3.
-unless (find_workstation($authtoken[1], BR3_ID, BR3_WORKSTATION)) {
+unless ($script->find_workstation(BR3_WORKSTATION, BR3_ID)) {
$script->register_workstation(BR3_WORKSTATION, BR3_ID);
}
diff --git a/Open-ILS/src/perlmods/live_t/25-lp1694058-multiple-hold-placement.t b/Open-ILS/src/perlmods/live_t/25-lp1694058-multiple-hold-placement.t
index 942aab2..5e74c9c 100644
--- a/Open-ILS/src/perlmods/live_t/25-lp1694058-multiple-hold-placement.t
+++ b/Open-ILS/src/perlmods/live_t/25-lp1694058-multiple-hold-placement.t
@@ -20,28 +20,6 @@ use constant {
COPY_ID => 2503,
};
-# Because this may run multiple times, without a DB reload, we search
-# for the workstation before registering it. Takes an authtoken, the
-# id of the workstation lib, and the name of the workstation.
-sub find_or_register_workstation {
- my ($authtoken, $lib, $workstation) = @_;
- my $ws;
- my $r = $U->simplereq(
- 'open-ils.actor',
- 'open-ils.actor.workstation.list',
- $authtoken,
- $lib
- );
- if ($r && $r->{$lib}) {
- $ws = grep {$_->name() eq $workstation} @{$r->{$lib}};
- }
- unless ($ws) {
- $ws = $script->register_workstation($workstation, $lib);
- }
- return $ws;
-}
-
-
# Keep track of hold ids, so we can cancel them later.
my @holds = ();
@@ -57,7 +35,7 @@ ok(
);
# Register workstation.
-my $ws = find_or_register_workstation($authtoken, BR1_ID, BR1_WORKSTATION);
+my $ws = $script->find_or_register_workstation(BR1_WORKSTATION, BR1_ID);
ok(
! ref $ws,
'Found or registered workstation'
-----------------------------------------------------------------------
Summary of changes:
.../src/perlmods/lib/OpenILS/Utils/TestUtils.pm | 23 +++++++++++++++++++
.../live_t/14-lp1499123_csp_ignore_proximity.t | 17 +-------------
.../live_t/18-lp1592891_sip_standing_penalties.t | 17 +-------------
.../19-lp1306666-abort-transit-copy-status.t | 21 +---------------
.../live_t/25-lp1694058-multiple-hold-placement.t | 24 +-------------------
5 files changed, 28 insertions(+), 74 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list