Bug 18330: (follow-up) Adapt holds.t to match the new datetime format
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 12 Dec 2017 21:35:47 +0000 (18:35 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 14 Dec 2017 19:58:22 +0000 (16:58 -0300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/api/v1/holds.t

index 05603be..8397f30 100644 (file)
@@ -28,6 +28,7 @@ use C4::Context;
 use C4::Reserves;
 
 use Koha::Database;
+use Koha::DateUtils;
 use Koha::Biblios;
 use Koha::Biblioitems;
 use Koha::Items;
@@ -219,11 +220,17 @@ subtest "Test endpoints without permission, but accessing own object" => sub {
     my $reserve_id3 = Koha::Holds->find({ borrowernumber => $nopermission->{borrowernumber} })->reserve_id;
     $tx = $t->ua->build_tx(PUT => "/api/v1/holds/$reserve_id3" => json => $put_data);
     $tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id});
-    $t->request_ok($tx) # create hold to myself
-      ->status_is(200)
-      ->json_is('/reserve_id', $reserve_id3)
-      ->json_is('/suspend_until', $suspend_until . ' 00:00:00')
-      ->json_is('/priority', 2);
+    $t->request_ok($tx)    # create hold to myself
+      ->status_is(200)->json_is( '/reserve_id', $reserve_id3 )->json_is(
+        '/suspend_until',
+        output_pref(
+            {
+                dateformat => 'rfc3339',
+                dt => dt_from_string( $suspend_until . ' 00:00:00', 'sql' )
+            }
+        )
+      )
+      ->json_is( '/priority', 2 );
 };
 
 subtest "Test endpoints with permission" => sub {
@@ -247,11 +254,17 @@ subtest "Test endpoints with permission" => sub {
 
     $tx = $t->ua->build_tx(PUT => "/api/v1/holds/$reserve_id" => json => $put_data);
     $tx->req->cookies({name => 'CGISESSID', value => $session3->id});
-    $t->request_ok($tx)
-      ->status_is(200)
-      ->json_is('/reserve_id', $reserve_id)
-      ->json_is('/suspend_until', $suspend_until . ' 00:00:00')
-      ->json_is('/priority', 2);
+    $t->request_ok($tx)->status_is(200)->json_is( '/reserve_id', $reserve_id )
+      ->json_is(
+        '/suspend_until',
+        output_pref(
+            {
+                dateformat => 'rfc3339',
+                dt => dt_from_string( $suspend_until . ' 00:00:00', 'sql' )
+            }
+        )
+      )
+      ->json_is( '/priority', 2 );
 
     $tx = $t->ua->build_tx(DELETE => "/api/v1/holds/$reserve_id");
     $tx->req->cookies({name => 'CGISESSID', value => $session3->id});