Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 53; |
20 |
use Test::More tests => 73; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Mojo; |
22 |
use Test::Mojo; |
23 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
Lines 110-115
$t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id")
Link Here
|
110 |
->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) |
110 |
->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) |
111 |
->json_hasnt('/2'); |
111 |
->json_hasnt('/2'); |
112 |
|
112 |
|
|
|
113 |
$t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_page=1&_page=1") |
114 |
->status_is(200) |
115 |
->header_is('X-Total-Count', '2') |
116 |
->header_like('Link', qr|rel="next"|) |
117 |
->header_like('Link', qr|rel="first"|) |
118 |
->header_like('Link', qr|rel="last"|) |
119 |
->json_is('/0/patron_id' => $patron_id) |
120 |
->json_is('/0/item_id' => $item1->itemnumber) |
121 |
->json_is('/0/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due1 }) ) |
122 |
->json_hasnt('/1'); |
123 |
|
124 |
$t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_page=1&_page=2") |
125 |
->status_is(200) |
126 |
->header_is('X-Total-Count', '2') |
127 |
->header_like('Link', qr|rel="prev"|) |
128 |
->header_like('Link', qr|rel="first"|) |
129 |
->header_like('Link', qr|rel="last"|) |
130 |
->json_is('/0/patron_id' => $patron_id) |
131 |
->json_is('/0/item_id' => $item2->itemnumber) |
132 |
->json_is('/0/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) |
133 |
->json_hasnt('/1'); |
134 |
|
113 |
$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id) |
135 |
$t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id) |
114 |
->status_is(200) |
136 |
->status_is(200) |
115 |
->json_is('/patron_id' => $patron_id) |
137 |
->json_is('/patron_id' => $patron_id) |
Lines 132-138
$dbh->do(q{
Link Here
|
132 |
VALUES (?, ?, ?, ?, ?) |
154 |
VALUES (?, ?, ?, ?, ?) |
133 |
}, {}, '*', '*', '*', 7, 1); |
155 |
}, {}, '*', '*', '*', 7, 1); |
134 |
|
156 |
|
135 |
my $expected_datedue = DateTime->now->add(days => 14)->set(hour => 23, minute => 59, second => 0); |
157 |
my $expected_datedue = DateTime->now |
|
|
158 |
->set_time_zone('local') |
159 |
->add(days => 14) |
160 |
->set(hour => 23, minute => 59, second => 0); |
136 |
$t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) |
161 |
$t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) |
137 |
->status_is(201) |
162 |
->status_is(201) |
138 |
->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) ) |
163 |
->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) ) |
139 |
- |
|
|