View | Details | Raw Unified | Return to bug 18407
Collapse All | Expand All

(-)a/t/db_dependent/api/v1/checkoutsexpanded.t (-2 / +23 lines)
Lines 47-53 my $module = new Test::MockModule('C4::Context'); Link Here
47
$module->mock('userenv', sub { { branch => $branchcode } });
47
$module->mock('userenv', sub { { branch => $branchcode } });
48
48
49
subtest 'get() tests' => sub {
49
subtest 'get() tests' => sub {
50
    plan tests => 17;
50
    plan tests => 34;
51
51
52
    $schema->storage->txn_begin;
52
    $schema->storage->txn_begin;
53
53
Lines 117-122 subtest 'get() tests' => sub { Link Here
117
        ->json_is('/1/max_renewals' => 1)
117
        ->json_is('/1/max_renewals' => 1)
118
        ->json_hasnt('/2');
118
        ->json_hasnt('/2');
119
119
120
    t::lib::Mocks::mock_preference('OpacRenewalAllowed', 0);
121
    $tx = $t->ua->build_tx(GET => "/api/v1/checkouts/expanded?borrowernumber="
122
                              .$borrowernumber);
123
    $tx->req->cookies({name =>'CGISESSID', value => $librariansessionid});
124
    $tx->req->env({REMOTE_ADDR => '127.0.0.1'});
125
    $t->request_ok($tx)
126
        ->status_is(200)
127
        ->json_is('/0/borrowernumber' => $borrowernumber)
128
        ->json_is('/0/itemnumber' => $itemnumber1)
129
        ->json_like('/0/date_due' => qr/$due\+\d\d:\d\d/)
130
        ->json_is('/0/renewals'   => 0)
131
        ->json_is('/0/renewable'  => Mojo::JSON->true)
132
        ->json_is('/0/renewability_error' => undef)
133
        ->json_is('/0/max_renewals' => 5)
134
        ->json_is('/1/borrowernumber' => $borrowernumber)
135
        ->json_is('/1/itemnumber' => $itemnumber2)
136
        ->json_like('/1/date_due' => qr/$due2\+\d\d:\d\d/)
137
        ->json_is('/1/renewals'   => 1)
138
        ->json_is('/1/renewable'  => Mojo::JSON->false)
139
        ->json_is('/1/renewability_error' => 'too_many')
140
        ->json_is('/1/max_renewals' => 1)
141
        ->json_hasnt('/2');
120
    $schema->storage->txn_rollback;
142
    $schema->storage->txn_rollback;
121
};
143
};
122
144
123
- 

Return to bug 18407