3 use Test::More tests => 14;
5 diag("Test circulation of item CONC70000345 against the admin user.");
7 use constant WORKSTATION_NAME => 'BR4-test-02-simple-circ.t';
8 use constant WORKSTATION_LIB => 7;
9 use constant ITEM_BARCODE => 'CONC70000345';
10 use constant ITEM_ID => 310;
12 use strict; use warnings;
14 use OpenILS::Utils::TestUtils;
15 my $script = OpenILS::Utils::TestUtils->new();
17 #----------------------------------------------------------------
18 # The tests... assumes stock sample data, full-auto install by
19 # eg_wheezy_installer.sh, etc.
20 #----------------------------------------------------------------
22 my $storage_ses = $script->session('open-ils.storage');
24 my $user_req = $storage_ses->request('open-ils.storage.direct.actor.user.retrieve', 1);
25 if (my $user_resp = $user_req->recv) {
26 if (my $user = $user_resp->content) {
29 'Fieldmapper::actor::user',
30 'open-ils.storage.direct.actor.user.retrieve returned aou object'
35 'User with id = 1 is admin user'
40 my $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', ITEM_ID);
41 if (my $item_resp = $item_req->recv) {
42 if (my $item = $item_resp->content) {
45 'Fieldmapper::asset::copy',
46 'open-ils.storage.direct.asset.copy.retrieve returned acp object'
51 'Item with id = ' . ITEM_ID . ' has barcode ' . ITEM_BARCODE
54 $item->status == 7 || $item->status == 0,
55 'Item with id = ' . ITEM_ID . ' has status of Reshelving or Available'
60 $script->authenticate({
62 password => 'demo123',
68 my $ws = $script->register_workstation(WORKSTATION_NAME,WORKSTATION_LIB);
71 'Registered a new workstation'
75 $script->authenticate({
77 password => 'demo123',
79 workstation => WORKSTATION_NAME});
82 'Have an authtoken associated with the workstation'
85 my $checkout_resp = $script->do_checkout({
87 barcode => ITEM_BARCODE});
91 'Checkout request returned a HASH'
94 $checkout_resp->{ilsevent},
96 'Checkout returned a SUCCESS event'
99 $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', 310);
100 if (my $item_resp = $item_req->recv) {
101 if (my $item = $item_resp->content) {
105 'Item with id = ' . ITEM_ID . ' has status of Checked Out after fresh Storage request'
110 my $checkin_resp = $script->do_checkin({
111 barcode => ITEM_BARCODE});
115 'Checkin request returned a HASH'
118 $checkin_resp->{ilsevent},
120 'Checkin returned a SUCCESS event'
123 $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', ITEM_ID);
124 if (my $item_resp = $item_req->recv) {
125 if (my $item = $item_resp->content) {
127 $item->status == 7 || $item->status == 0,
128 'Item with id = ' . ITEM_ID . ' has status of Reshelving or Available after fresh Storage request'