X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=blobdiff_plain;f=t%2F02-xml-simple.t;fp=t%2F01-yaml.t;h=ccc9c00da7c18979a1a96824baca67d925b4a593;hp=7559615a55a19234a1cd909c74386659ca139db7;hb=e601addaf89882fccbc824c1a53328f0d049b32b;hpb=17d910bd120ee243917756ae8c4281e621a4f986 diff --git a/t/01-yaml.t b/t/02-xml-simple.t similarity index 60% rename from t/01-yaml.t rename to t/02-xml-simple.t index 7559615..ccc9c00 100644 --- a/t/01-yaml.t +++ b/t/02-xml-simple.t @@ -2,31 +2,33 @@ use strict; use warnings; use Test::More qw(no_plan); use FindBin; +use Data::Dump qw(dump); use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib"); use Test::Rest; use_ok 'Catalyst::Test', 'Test::Serialize'; -# Should use the default serializer, YAML -my $t = Test::Rest->new('content_type' => 'text/x-yaml'); +my $t = Test::Rest->new('content_type' => 'text/xml'); -my $has_serializer = eval "require YAML::Syck"; +my $has_serializer = eval "require XML::Simple"; SKIP: { - skip "YAML::Syck not available", 4, unless $has_serializer; + skip "XML::Simple not available", 4, unless $has_serializer; + + my $xs = XML::Simple->new('ForceArray' => 0); - # We should use the default serializer, YAML my $monkey_template = { monkey => 'likes chicken!', }; my $mres = request($t->get(url => '/monkey_get')); ok( $mres->is_success, 'GET the monkey succeeded' ); - is_deeply(YAML::Syck::Load($mres->content), $monkey_template, "GET returned the right data"); + my $output = $xs->XMLin($mres->content); + is_deeply($xs->XMLin($mres->content)->{'data'}, $monkey_template, "GET returned the right data"); my $post_data = { 'sushi' => 'is good for monkey', }; - my $mres_post = request($t->post(url => '/monkey_put', data => YAML::Syck::Dump($post_data))); + my $mres_post = request($t->post(url => '/monkey_put', data => $xs->XMLout($post_data))); ok( $mres_post->is_success, "POST to the monkey succeeded"); is_deeply($mres_post->content, "is good for monkey", "POST data matches"); };