[Jifty-commit] r4557 - in Net-Jifty: . t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Nov 28 16:55:26 EST 2007


Author: sartak
Date: Wed Nov 28 16:55:25 2007
New Revision: 4557

Modified:
   Net-Jifty/   (props changed)
   Net-Jifty/t/003-crud.t
   Net-Jifty/t/lib/Net/Jifty/Test.pm

Log:
 r45719 at onn:  sartak | 2007-11-28 16:55:20 -0500
 Fix tests for the new LWP::UA->request


Modified: Net-Jifty/t/003-crud.t
==============================================================================
--- Net-Jifty/t/003-crud.t	(original)
+++ Net-Jifty/t/003-crud.t	Wed Nov 28 16:55:25 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 13;
+use Test::More tests => 15;
 use lib 't/lib';
 use Net::Jifty::Test;
 
@@ -28,15 +28,17 @@
 $j->ua->clear;
 $j->update("Foo", a => 'b', c => 'C', d => 'e');
 ($name, $args) = $j->ua->next_call;
-is($name, 'put', 'used put for update');
-is_deeply($args->[1], 'http://jifty.org/=/model/JiftyApp.Model.Foo/a/b.yml', 'correct URL');
-is_deeply($args->[2], {c => 'C', d => 'e'}, 'correct arguments');
+is($name, 'request', 'used request for update');
+isa_ok($args->[1], 'HTTP::Request', 'got an HTTP::Request object');
+is($args->[1]->uri, 'http://jifty.org/=/model/JiftyApp.Model.Foo/a/b.yml', 'correct URL');
+like($args->[1]->content, qr/^(?:c=C&d=e|d=e&c=C)$/, 'correct arguments');
 
 $j->ua->clear;
 $j->delete("Foo", '"' => '?');
 ($name, $args) = $j->ua->next_call;
-is($name, 'delete', 'used delete for delete');
-is_deeply($args->[1], 'http://jifty.org/=/model/JiftyApp.Model.Foo/%22/%3F.yml', 'correct URL');
+is($name, 'request', 'used request for delete');
+isa_ok($args->[1], 'HTTP::Request', 'got an HTTP::Request object');
+is($args->[1]->uri, 'http://jifty.org/=/model/JiftyApp.Model.Foo/%22/%3F.yml', 'correct URL');
 
 $j->ua->clear;
 $j->act("Foo", '"' => '?');

Modified: Net-Jifty/t/lib/Net/Jifty/Test.pm
==============================================================================
--- Net-Jifty/t/lib/Net/Jifty/Test.pm	(original)
+++ Net-Jifty/t/lib/Net/Jifty/Test.pm	Wed Nov 28 16:55:25 2007
@@ -5,6 +5,7 @@
 
 use Test::MockObject;
 
+our $content_type = "text/x-yaml";
 our $content = << "YAML";
 ---
 fnord:
@@ -31,8 +32,9 @@
         # the result object. change $Net::Jifty::Test::content to change the
         # results
         my $res = Test::MockObject->new;
-        $res->set_bound(is_success => \$content);
-        $res->set_bound(content    => \$content);
+        $res->set_bound(is_success   => \$content);
+        $res->set_bound(content      => \$content);
+        $res->set_bound(content_type => \$content_type);
 
         # the cookie object. the cookie name is hardcoded to JIFTY_SID
         my $cookie = Test::MockObject->new;
@@ -40,7 +42,7 @@
         $cookie->set_true('set_cookie');
 
         my $mock = Test::MockObject->new;
-        for (qw/get post put delete head/) {
+        for (qw/get post head request/) {
             $mock->set_always($_ => $res);
         }
         $mock->set_always(cookie_jar => $cookie);


More information about the Jifty-commit mailing list