Bug 20600: (follow-up) Fix tests
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Mon, 14 Jan 2019 10:41:34 +0000 (10:41 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 19 Feb 2019 16:36:43 +0000 (16:36 +0000)
Some silly variable name typos in the tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

t/db_dependent/api/v1/illrequests.t

index 91fa544..59a6bc5 100644 (file)
@@ -99,7 +99,7 @@ subtest 'list() tests' => sub {
     my $response = $illrequest->unblessed;
     $response->{id_prefix} = $illrequest->id_prefix;
 
-    my $req_formatted = add_formatted($illrequest);
+    my $req_formatted = add_formatted($response);
 
     # One illrequest created, should get returned
     $tx = $t->ua->build_tx( GET => '/api/v1/illrequests' );
@@ -134,7 +134,7 @@ subtest 'list() tests' => sub {
     my $response2 = $illrequest2->unblessed;
     $response2->{id_prefix} = $illrequest2->id_prefix;
 
-    my $req2_formatted = add_formatted($illrequest2);
+    my $req2_formatted = add_formatted($response2);
 
     # Two illrequest created, should get returned
     $tx = $t->ua->build_tx( GET => '/api/v1/illrequests' );
@@ -159,20 +159,19 @@ sub add_formatted {
     my @format_dates = ( 'placed', 'updated' );
     # We need to embellish the request with properties that the API
     # controller calculates on the fly
-    my $req_unblessed = $req->unblessed;
     # Create new "formatted" columns for each date column
     # that needs formatting
     foreach my $field(@format_dates) {
-        if (defined $req_unblessed->{$field}) {
-            $req_unblessed->{$field . "_formatted"} = format_sqldatetime(
-                $req_unblessed->{$field},
+        if (defined $req->{$field}) {
+            $req->{$field . "_formatted"} = format_sqldatetime(
+                $req->{$field},
                 undef,
                 undef,
                 1
             );
         }
     }
-    return $req_unblessed;
+    return $req;
 }
 
 sub create_user_and_session {