[open-ils-commits] [GIT] Evergreen ILS branch master updated. 5baf8d10a1e834d810de77083c0bbfbfdd805107

Evergreen Git git at git.evergreen-ils.org
Tue Jul 21 10:52:32 EDT 2020


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  5baf8d10a1e834d810de77083c0bbfbfdd805107 (commit)
      from  411ca2231362f4c3e05efb4ff6f6312157e199f6 (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 5baf8d10a1e834d810de77083c0bbfbfdd805107
Author: Jeff Davis <jeff.davis at bc.libraries.coop>
Date:   Thu Oct 10 16:01:06 2019 -0700

    LP#1847680: live test for barcode completion
    
    Signed-off-by: Jeff Davis <jeff.davis at bc.libraries.coop>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/perlmods/live_t/30-barcode-completion.t b/Open-ILS/src/perlmods/live_t/30-barcode-completion.t
new file mode 100644
index 0000000000..84a815fed5
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/30-barcode-completion.t
@@ -0,0 +1,99 @@
+#!perl
+
+use Test::More tests => 4;
+
+diag("Tests barcode completion");
+
+use strict; use warnings;
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::CStoreEditor (':funcs');
+use OpenILS::Utils::Fieldmapper;
+our $U = "OpenILS::Application::AppUtils";
+
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap();
+
+# test values
+my $org = 5; # test org: BR2
+my $bc_base = 'bc_complete_user';
+my $bc_prefix = 'JUSTATEST_';
+my $bc = $bc_prefix . $bc_base;
+
+# get authtoken for future use
+$script->authenticate({
+    username => 'admin',
+    password => 'demo123',
+    type => 'staff'
+});
+
+my $authtoken = $script->authtoken;
+ok($authtoken, 'was able to authenticate');
+
+# create test user
+my $new_user = Fieldmapper::actor::user->new();
+my $new_card = Fieldmapper::actor::card->new();
+
+$new_card->barcode($bc);
+$new_card->id(-1); # virtual ID
+$new_card->usr(undef);
+$new_card->isnew(1);
+
+$new_user->cards([ $new_card ]);
+$new_user->card($new_card);
+$new_user->usrname($bc);
+$new_user->passwd('dummypwd');
+$new_user->family_name('Doe');
+$new_user->first_given_name('Jane');
+$new_user->profile(2);
+$new_user->home_ou($org);
+$new_user->ident_type(1);
+$new_user->isnew(1);
+
+my $user = $U->simplereq(
+    'open-ils.actor',
+    'open-ils.actor.patron.update',
+    $authtoken,
+    $new_user
+);
+isa_ok($user, 'Fieldmapper::actor::user', 'new patron');
+
+# create barcode completion rule
+my $new_rule = Fieldmapper::config::barcode_completion->new();
+
+$new_rule->isnew(1);
+$new_rule->active('t');
+$new_rule->org_unit($org);
+$new_rule->prefix($bc_prefix);
+$new_rule->actor('t');
+$new_rule->asset('f'); # TODO test item barcodes too
+
+my $e = new_editor(xact => 1);
+$e->init;
+
+$e->xact_begin;
+$e->create_config_barcode_completion($new_rule);
+$e->xact_commit;
+
+my $bc_rule = $e->search_config_barcode_completion({
+    org_unit => 5, actor => 't', prefix => $bc_prefix
+})->[0];
+isa_ok($bc_rule, 'Fieldmapper::config::barcode_completion', 'Created and retrieved new barcode completion rule');
+
+my $get_barcodes = $U->simplereq(
+    'open-ils.actor',
+    'open-ils.actor.get_barcodes',
+    $authtoken, $org, 'actor', $bc_base
+);
+is($get_barcodes->[0]->{barcode}, $bc, 'Retrieved correct user with barcode completion');
+
+# clean up
+$U->simplereq(
+    'open-ils.actor',
+    'open-ils.actor.user.delete',
+    $authtoken,
+    $user->id()
+);
+$e->xact_begin;
+$e->delete_config_barcode_completion($bc_rule);
+$e->commit;
+

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/live_t/30-barcode-completion.t    | 99 ++++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 Open-ILS/src/perlmods/live_t/30-barcode-completion.t


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list