Skip Menu |

This queue is for tickets about the Catalyst-Controller-DBIC-API CPAN distribution.

Report information
The Basics
Id: 90188
Status: resolved
Priority: 0/
Queue: Catalyst-Controller-DBIC-API

People
Owner: abraxxa [...] cpan.org
Requestors: SKAUFMAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.005001



Subject: Failing tests, t/rest/item.t t/rest/list.t due to breaking changes in JSON.pm
As of JSON 2.9, JSON no longer overloads eq. Therefore JSON::true ne 'true' The tests relied on overload of eq in JSON to check for "true" when json were in use. Proposed fix in tests, check for JSON::true instead of eq 'true'. Patch is attached.
Subject: Catalyst-Controller-API-Rest.patch
diff --git a/t/rest/item.t b/t/rest/item.t index dea2b88..a2a50dd 100644 --- a/t/rest/item.t +++ b/t/rest/item.t @@ -29,6 +29,7 @@ my $artist_view_url = "$base/api/rest/artist/"; my %expected_response = $schema->resultset('Artist')->find($id)->get_columns; my $response = $json->decode( $mech->content ); + #artist does not have use_json_boolean => 1, so true values are stringified to 'true' is_deeply( $response, { data => \%expected_response, success => 'true' }, @@ -65,7 +66,7 @@ my $track_view_url = "$base/api/rest/track/"; my $response = $json->decode( $mech->content ); is_deeply( $response, - { data => \%expected_response, success => 'true' }, + { data => \%expected_response, success => JSON::true }, 'correct data returned for track with datetime' ); } diff --git a/t/rest/list.t b/t/rest/list.t index 3afd448..7337531 100644 --- a/t/rest/list.t +++ b/t/rest/list.t @@ -203,7 +203,7 @@ my $track_list_url = "$base/api/rest/track"; } $schema->resultset('Track')->search( undef, { page => 1, } )->all; is_deeply( $response, - { list => \@expected_response, success => 'true', totalcount => 15 }, + { list => \@expected_response, success => JSON::true, totalcount => 15 }, 'correct data returned for static configured paging' ); }
Am Sa 09. Nov 2013, 12:11:47, SKAUFMAN schrieb: Show quoted text
> As of JSON 2.9, JSON no longer overloads eq. Therefore JSON::true ne > 'true' > > The tests relied on overload of eq in JSON to check for "true" when > json were in use. > Proposed fix in tests, check for JSON::true instead of eq 'true'. > > Patch is attached.
Thanks for the patch Samuel! Can you please create the patch in git format so you can be seen in the git history as the author? Instructions how to do that can be found for example here: https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
Ah cool, I didn't know of that feature. git formatted patch attached. On Sun Nov 10 14:10:04 2013, ABRAXXA wrote: Show quoted text
> Am Sa 09. Nov 2013, 12:11:47, SKAUFMAN schrieb:
> > As of JSON 2.9, JSON no longer overloads eq. Therefore JSON::true ne > > 'true' > > > > The tests relied on overload of eq in JSON to check for "true" when > > json were in use. > > Proposed fix in tests, check for JSON::true instead of eq 'true'. > > > > Patch is attached.
> > > Thanks for the patch Samuel! > Can you please create the patch in git format so you can be seen in > the git history as the author? > Instructions how to do that can be found for example here: > https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with- > git/
Subject: json_test_fixes.patch
From 267b7986efb2a80b1d61ecec4eb7a5f06b9d8ebf Mon Sep 17 00:00:00 2001 From: skaufman <sam@socialflow.com> Date: Sun, 10 Nov 2013 19:15:43 +0000 Subject: [PATCH] Removed tests' reliance on deprecated JSON behaviour of overloading eq operator --- t/rest/item.t | 3 ++- t/rest/list.t | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/t/rest/item.t b/t/rest/item.t index dea2b88..a2a50dd 100644 --- a/t/rest/item.t +++ b/t/rest/item.t @@ -29,6 +29,7 @@ my $artist_view_url = "$base/api/rest/artist/"; my %expected_response = $schema->resultset('Artist')->find($id)->get_columns; my $response = $json->decode( $mech->content ); + #artist does not have use_json_boolean => 1, so true values are stringified to 'true' is_deeply( $response, { data => \%expected_response, success => 'true' }, @@ -65,7 +66,7 @@ my $track_view_url = "$base/api/rest/track/"; my $response = $json->decode( $mech->content ); is_deeply( $response, - { data => \%expected_response, success => 'true' }, + { data => \%expected_response, success => JSON::true }, 'correct data returned for track with datetime' ); } diff --git a/t/rest/list.t b/t/rest/list.t index 3afd448..7337531 100644 --- a/t/rest/list.t +++ b/t/rest/list.t @@ -203,7 +203,7 @@ my $track_list_url = "$base/api/rest/track"; } $schema->resultset('Track')->search( undef, { page => 1, } )->all; is_deeply( $response, - { list => \@expected_response, success => 'true', totalcount => 15 }, + { list => \@expected_response, success => JSON::true, totalcount => 15 }, 'correct data returned for static configured paging' ); } -- 1.7.10.4
Applied as c2a3a0b3cb58c6417fcbd9a6a392744c82dc64cc, updated Changes and dist metadata in following commit.
On Sun Nov 10 14:43:07 2013, ABRAXXA wrote: Show quoted text
> Applied as c2a3a0b3cb58c6417fcbd9a6a392744c82dc64cc, updated Changes > and dist metadata in following commit.
Thanks for patching. Can we expect a new release any time soon? Thanks
Yes, I've been working on DBIC::API last week and now that PAUSE is up again I plan to upload a 2.005001 this week.
I've released 2.005001 yesterday evening which includes the fix.