From: Alexander Hartmaier Date: Tue, 19 Apr 2011 15:13:01 +0000 (+0200) Subject: fixed invalid value for param test to succeed with newer DBIx::Class versions X-Git-Tag: 2.003002~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=commitdiff_plain;h=fd6fb6c9a7485d534134558a1de31ba3ae8e2f21 fixed invalid value for param test to succeed with newer DBIx::Class versions --- diff --git a/Changes b/Changes index 6c76114..6b9e2a6 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ Revision history for Catalyst-Controller-DBIC-API: {{ $dist->version }} {{ $NEXT }} - Added has_errors method +- Fixed tests to succeed with newer DBIx::Class versions 2.003001 2011-02-16 17:52:37 Europe/Vienna diff --git a/t/rpc/create.t b/t/rpc/create.t index 7d7fe41..f2757a3 100644 --- a/t/rpc/create.t +++ b/t/rpc/create.t @@ -102,15 +102,25 @@ my $producer_create_url = "$base/api/rpc/producer/create"; # test create returns an error as expected when passing invalid value { - my $long_string = '-' x 1024; + my $data = { + producerid => 100, + name => 'Producer', + }; - my $req = POST( - $producer_create_url, - { producerid => $long_string, - name => $long_string, - }, - 'Accept' => 'text/json' + my $req = POST($producer_create_url, $data, 'Accept' => 'text/json'); + $mech->request( $req, $content_type ); + cmp_ok( $mech->status, '==', 200, 'create with pk value ok' ); + my $response = $json->decode( $mech->content ); + is_deeply( + $response, + { success => 'true', list => $data }, + 'json for producer with pk value ok' ); + # try to insert same data again, as this seems to be the only way to + # force an insert to fail for SQLite. + # It accepts too long columns as well as wrong datatypes without errors. + # The bind with datatype of newer DBIC versions numifies non-integer + # values passed as pk value too. $mech->request( $req, $content_type ); cmp_ok( $mech->status, '==', 400, 'invalid param value produces error' ); }