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
19 #----------------------------------------------------------------
21 my $storage_ses = $script->session('open-ils.storage');
23 my $user_req = $storage_ses->request('open-ils.storage.direct.actor.user.retrieve', 1);
24 if (my $user_resp = $user_req->recv) {
25 if (my $user = $user_resp->content) {
28 'Fieldmapper::actor::user',
29 'open-ils.storage.direct.actor.user.retrieve returned aou object'
34 'User with id = 1 is admin user'
39 my $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', ITEM_ID);
40 if (my $item_resp = $item_req->recv) {
41 if (my $item = $item_resp->content) {
44 'Fieldmapper::asset::copy',
45 'open-ils.storage.direct.asset.copy.retrieve returned acp object'
50 'Item with id = ' . ITEM_ID . ' has barcode ' . ITEM_BARCODE
53 $item->status == 7 || $item->status == 0,
54 'Item with id = ' . ITEM_ID . ' has status of Reshelving or Available'
59 $script->authenticate({
61 password => 'demo123',
67 my $ws = $script->register_workstation(WORKSTATION_NAME,WORKSTATION_LIB);
70 'Registered a new workstation'
74 $script->authenticate({
76 password => 'demo123',
78 workstation => WORKSTATION_NAME});
81 'Have an authtoken associated with the workstation'
84 my $checkout_resp = $script->do_checkout({
86 barcode => ITEM_BARCODE});
90 'Checkout request returned a HASH'
93 $checkout_resp->{ilsevent},
95 'Checkout returned a SUCCESS event'
98 $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', 310);
99 if (my $item_resp = $item_req->recv) {
100 if (my $item = $item_resp->content) {
104 'Item with id = ' . ITEM_ID . ' has status of Checked Out after fresh Storage request'
109 my $checkin_resp = $script->do_checkin({
110 barcode => ITEM_BARCODE});
114 'Checkin request returned a HASH'
117 $checkin_resp->{ilsevent},
119 'Checkin returned a SUCCESS event'
122 $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', ITEM_ID);
123 if (my $item_resp = $item_req->recv) {
124 if (my $item = $item_resp->content) {
126 $item->status == 7 || $item->status == 0,
127 'Item with id = ' . ITEM_ID . ' has status of Reshelving or Available after fresh Storage request'