[Jifty-commit] r4862 - in jifty/trunk: . t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Jan 15 22:11:35 EST 2008


Author: sartak
Date: Tue Jan 15 22:11:35 2008
New Revision: 4862

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm
   jifty/trunk/t/TestApp-Plugin-OAuth/t/05-protected-resource.t

Log:
 r50441 at onn:  sartak | 2008-01-15 22:10:52 -0500
 Improve tests, the basic protected resource request works, yay. PLAINTEXT fixes.


Modified: jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm	(original)
+++ jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm	Tue Jan 15 22:11:35 2008
@@ -66,7 +66,7 @@
     my $consumer_secret = delete $params{consumer_secret}
         or die "consumer_secret not passed to response_is!";
 
-    if ($url !~ /request_token/) {
+    if ($url =~ /access_token/) {
         $token_secret ||= $token_obj->secret;
         $params{oauth_token} ||= $token_obj->token;
     }

Modified: jifty/trunk/t/TestApp-Plugin-OAuth/t/05-protected-resource.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-OAuth/t/05-protected-resource.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-OAuth/t/05-protected-resource.t	Tue Jan 15 22:11:35 2008
@@ -5,7 +5,7 @@
 use Test::More;
 BEGIN {
     if (eval { require Net::OAuth::Request; require Crypt::OpenSSL::RSA; 1 }) {
-        plan tests => 16;
+        plan tests => 19;
     }
     else {
         plan skip_all => "Net::OAuth isn't installed";
@@ -51,8 +51,21 @@
 $umech->content_contains('Logout');
 # }}}
 # }}}
+# make sure we're not logged in {{{
+response_is(
+    url                    => '/nuke/the/whales',
+    code                   => 200,
+    testname               => "200 - protected resource request",
+    consumer_secret        => 'bar',
+    oauth_consumer_key     => 'foo',
+    oauth_signature_method => 'PLAINTEXT',
+);
+$cmech->content_contains("Login with a password", "redirected to login");
+$cmech->content_lacks("Press the shiny red button", "did NOT get to a protected page");
+# }}}}
 # basic protected request {{{
 get_access_token();
+
 response_is(
     url                    => '/nuke/the/whales',
     code                   => 200,
@@ -60,6 +73,8 @@
     consumer_secret        => 'bar',
     oauth_consumer_key     => 'foo',
     oauth_signature_method => 'PLAINTEXT',
+    oauth_token            => $token_obj->token,
+    token_secret           => $token_obj->secret,
 );
 $cmech->content_contains("Press the shiny red button", "got to a protected page");
 # }}}


More information about the Jifty-commit mailing list