Commit | Line | Data |
e601adda |
1 | use strict; |
2 | use warnings; |
6646fdc2 |
3 | use Test::More tests => 5; |
e601adda |
4 | use YAML::Syck; |
5 | use FindBin; |
6 | use Data::Dump qw(dump); |
7 | |
8 | use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken"); |
9 | use Test::Rest; |
10 | |
11 | # Should use Data::Dumper, via Data::Serializer |
12 | my $t = Test::Rest->new('content_type' => 'text/x-yaml'); |
13 | |
c5c27d42 |
14 | use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST'; |
15 | my $url = '/deserialize/test'; |
e601adda |
16 | |
c5c27d42 |
17 | my $res = request($t->put( url => $url, data => Dump({ kitty => "LouLou" }))); |
e601adda |
18 | ok( $res->is_success, 'PUT Deserialize request succeeded' ); |
19 | is( $res->content, "LouLou", "Request returned deserialized data"); |
20 | |
21 | my $nt = Test::Rest->new('content_type' => 'text/broken'); |
c5c27d42 |
22 | my $bres = request($nt->put( url => $url, data => Dump({ kitty => "LouLou" }))); |
e601adda |
23 | is( $bres->code, 415, 'PUT on un-useable Deserialize class returns 415'); |
24 | |
25 | my $ut = Test::Rest->new('content_type' => 'text/not-happening'); |
c5c27d42 |
26 | my $ures = request($ut->put( url => $url, data => Dump({ kitty => "LouLou" }))); |
e601adda |
27 | is ($bres->code, 415, 'GET on unknown Content-Type returns 415'); |
28 | |
29 | 1; |