[Jifty-commit] jifty-plugin-oauth branch, master, updated. a82e237696e74fad7e7f71a0c5764de03bacfb42

Jifty commits jifty-commit at lists.jifty.org
Tue Mar 2 14:54:58 EST 2010


The branch, master has been updated
       via  a82e237696e74fad7e7f71a0c5764de03bacfb42 (commit)
       via  f764fa10f19f0abc75cd500d5f32ed0d8ed3ca36 (commit)
       via  7ba65bec7cab8abd2412e69742873abc4469be0a (commit)
       via  e9b03495f1a01db962da193b4652e0b0f71f8bd4 (commit)
       via  28efef356cb8cf43d49b19611fbf9b74843cb4dc (commit)
      from  720aec4cbad2772be262892ee5419c5fb9faf798 (commit)

Summary of changes:
 lib/Jifty/Plugin/OAuth/Dispatcher.pm |   12 ++++++------
 t/lib/TestApp/Plugin/OAuth/Test.pm   |    4 ++--
 t/t/02-request-token.t               |    3 +--
 t/t/03-authorize.t                   |    3 +--
 t/t/04-access-token.t                |    3 +--
 t/t/05-protected-resource.t          |    3 +--
 t/t/06-read-only.t                   |    5 +++--
 t/t/07-read-write.t                  |    4 ++--
 8 files changed, 17 insertions(+), 20 deletions(-)

- Log -----------------------------------------------------------------
commit 28efef356cb8cf43d49b19611fbf9b74843cb4dc
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Fri Jan 1 17:05:40 2010 +0800

    avoid Jifty->handler->apache

diff --git a/lib/Jifty/Plugin/OAuth/Dispatcher.pm b/lib/Jifty/Plugin/OAuth/Dispatcher.pm
index e20d230..a6dac14 100644
--- a/lib/Jifty/Plugin/OAuth/Dispatcher.pm
+++ b/lib/Jifty/Plugin/OAuth/Dispatcher.pm
@@ -67,7 +67,7 @@ sub request_token {
     # Net::OAuth::Request will die hard if it doesn't get everything it wants
     my $request = eval { Net::OAuth::RequestTokenRequest->new(
         request_url     => Jifty->web->url(path => '/oauth/request_token'),
-        request_method  => Jifty->handler->apache->method(),
+        request_method  => Jifty->web->request->method,
         consumer_secret => $consumer->secret,
         signature_key   => $signature_key,
 
@@ -178,7 +178,7 @@ sub access_token {
     # Net::OAuth::Request will die hard if it doesn't get everything it wants
     my $request = eval { Net::OAuth::AccessTokenRequest->new(
         request_url     => Jifty->web->url(path => '/oauth/access_token'),
-        request_method  => Jifty->handler->apache->method(),
+        request_method  => Jifty->web->request->method,
         consumer_secret => $consumer->secret,
         token_secret    => $request_token->secret,
         signature_key   => $signature_key,
@@ -252,7 +252,7 @@ sub try_oauth
     # Net::OAuth::Request will die hard if it doesn't get everything it wants
     my $request = eval { Net::OAuth::ProtectedResourceRequest->new(
         request_url     => Jifty->web->url(path => Jifty->web->request->path),
-        request_method  => Jifty->handler->apache->method(),
+        request_method  => Jifty->web->request->method,
         consumer_secret => $consumer->secret,
         token_secret    => $access_token->secret,
         signature_key   => $signature_key,
@@ -387,10 +387,10 @@ The precedence of parameters, from highest priority to lowest priority, is:
 
 sub get_parameters {
     my %p;
-    my %params = Jifty->handler->apache->params();
+    my %params = %{ Jifty->web->request->params };
 
     # Check Authorization header
-    my $authz = Jifty->handler->apache->header_in("Authorization");
+    my $authz = Jifty->web->request->header("Authorization");
     if ($authz && $authz =~ s/^\s*OAuth\s*//i) {
         while ($authz =~ m{\s*([%a-zA-Z0-9._~-]+)="([%a-zA-Z0-9._~-]*)"\s*}g) {
             $params{uri_unescape($1)} = uri_unescape($2);

commit e9b03495f1a01db962da193b4652e0b0f71f8bd4
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Fri Jan 29 22:23:38 2010 +0800

    Be more Plack 1.0-ready.

diff --git a/lib/Jifty/Plugin/OAuth/Dispatcher.pm b/lib/Jifty/Plugin/OAuth/Dispatcher.pm
index a6dac14..38adcaa 100644
--- a/lib/Jifty/Plugin/OAuth/Dispatcher.pm
+++ b/lib/Jifty/Plugin/OAuth/Dispatcher.pm
@@ -284,7 +284,7 @@ This aborts the request with an "invalid HTTP method" response code.
 =cut
 
 sub invalid_method {
-    Jifty->web->response->add_header(Allow => 'POST');
+    Jifty->web->response->header(Allow => 'POST');
     abort(405);
 }
 
@@ -387,7 +387,7 @@ The precedence of parameters, from highest priority to lowest priority, is:
 
 sub get_parameters {
     my %p;
-    my %params = %{ Jifty->web->request->params };
+    my %params = %{ Jifty->web->request->parameters };
 
     # Check Authorization header
     my $authz = Jifty->web->request->header("Authorization");

commit 7ba65bec7cab8abd2412e69742873abc4469be0a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Feb 7 11:28:59 2010 +0800

    actual_server for tests

diff --git a/t/lib/TestApp/Plugin/OAuth/Test.pm b/t/lib/TestApp/Plugin/OAuth/Test.pm
index 55afb03..1dc441d 100644
--- a/t/lib/TestApp/Plugin/OAuth/Test.pm
+++ b/t/lib/TestApp/Plugin/OAuth/Test.pm
@@ -26,7 +26,7 @@ our $can_write;
 
 sub setup {
     my $class = shift;
-    $class->SUPER::setup;
+    $class->SUPER::setup(@_);
     $class->export_to_level(1);
 }
 
@@ -199,7 +199,7 @@ sub has_rsa {
 
 sub rsa_skip {
     my $count = shift || Carp::carp "You must specify a number of tests to skip.";
-    ::skip 'Crypt::OpenSSL::RSA is required for these tests', $count unless has_rsa;
+    ::skip( 'Crypt::OpenSSL::RSA is required for these tests', $count ) unless has_rsa;
 }
 
 sub slurp {
diff --git a/t/t/02-request-token.t b/t/t/02-request-token.t
index ac1a27c..2b1051c 100644
--- a/t/t/02-request-token.t
+++ b/t/t/02-request-token.t
@@ -3,8 +3,7 @@ use warnings;
 use strict;
 
 use lib 't/lib';
-use Test::More tests => 61;
-use TestApp::Plugin::OAuth::Test;
+use TestApp::Plugin::OAuth::Test tests => 61, actual_server => 1;
 start_server();
 
 # create some consumers {{{
diff --git a/t/t/03-authorize.t b/t/t/03-authorize.t
index 821e79a..11dc954 100644
--- a/t/t/03-authorize.t
+++ b/t/t/03-authorize.t
@@ -3,8 +3,7 @@ use warnings;
 use strict;
 
 use lib 't/lib';
-use Test::More tests => 85;
-use TestApp::Plugin::OAuth::Test;
+use TestApp::Plugin::OAuth::Test tests => 85, actual_server => 1;
 
 use Jifty::Test::WWW::Mechanize;
 start_server();
diff --git a/t/t/04-access-token.t b/t/t/04-access-token.t
index 4c54f58..ce86e5a 100644
--- a/t/t/04-access-token.t
+++ b/t/t/04-access-token.t
@@ -3,8 +3,7 @@ use warnings;
 use strict;
 
 use lib 't/lib';
-use Test::More tests => 70;
-use TestApp::Plugin::OAuth::Test;
+use TestApp::Plugin::OAuth::Test tests => 70, actual_server => 1;
 
 use Jifty::Test::WWW::Mechanize;
 
diff --git a/t/t/05-protected-resource.t b/t/t/05-protected-resource.t
index f8248bf..ace2911 100644
--- a/t/t/05-protected-resource.t
+++ b/t/t/05-protected-resource.t
@@ -3,8 +3,7 @@ use warnings;
 use strict;
 
 use lib 't/lib';
-use Test::More tests => 58;
-use TestApp::Plugin::OAuth::Test;
+use TestApp::Plugin::OAuth::Test tests => 58, actual_server => 1;
 
 use Jifty::Test::WWW::Mechanize;
 
diff --git a/t/t/06-read-only.t b/t/t/06-read-only.t
index 3f28651..3410d41 100644
--- a/t/t/06-read-only.t
+++ b/t/t/06-read-only.t
@@ -3,8 +3,7 @@ use warnings;
 use strict;
 
 use lib 't/lib';
-use Test::More tests => 29;
-use TestApp::Plugin::OAuth::Test;
+use TestApp::Plugin::OAuth::Test tests => 29, actual_server => 1;
 
 use Jifty::Test::WWW::Mechanize;
 
diff --git a/t/t/07-read-write.t b/t/t/07-read-write.t
index d454c55..53fc3c5 100644
--- a/t/t/07-read-write.t
+++ b/t/t/07-read-write.t
@@ -3,8 +3,7 @@ use warnings;
 use strict;
 
 use lib 't/lib';
-use Test::More tests => 28;
-use TestApp::Plugin::OAuth::Test;
+use TestApp::Plugin::OAuth::Test tests => 28, actual_server => 1;
 
 use Jifty::Test::WWW::Mechanize;
 

commit f764fa10f19f0abc75cd500d5f32ed0d8ed3ca36
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Sun Feb 7 12:17:36 2010 +0800

    Disallow redirect for REST requests so we can check against the success flag, not the created record.

diff --git a/t/t/06-read-only.t b/t/t/06-read-only.t
index 3410d41..5bae801 100644
--- a/t/t/06-read-only.t
+++ b/t/t/06-read-only.t
@@ -93,9 +93,11 @@ $favorites->unlimit;
 is($favorites->count, 0, "no favorites found");
 # }}}
 # user REST POST {{{
+$umech->requests_redirectable([]);
 $umech->post("$URL/=/model/Favorite.yml",
     { thing => 'more tests' },
 );
+
 $umech->content_contains("success: 1", "created a favorite");
 
 $favorites = TestApp::Plugin::OAuth::Model::FavoriteCollection->new(
diff --git a/t/t/07-read-write.t b/t/t/07-read-write.t
index 53fc3c5..5b6a506 100644
--- a/t/t/07-read-write.t
+++ b/t/t/07-read-write.t
@@ -97,6 +97,7 @@ is($favorites->count, 1, "no favorites found");
 is($favorites->first->thing, 'tests', "correct argument");
 # }}}
 # user REST POST {{{
+$umech->requests_redirectable([]);
 $umech->post("$URL/=/model/Favorite.yml",
     { thing => 'more tests' },
 );

commit a82e237696e74fad7e7f71a0c5764de03bacfb42
Merge: 720aec4 f764fa1
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Fri Feb 26 18:16:03 2010 -1000

    Merge branch 'plack'


-----------------------------------------------------------------------


More information about the Jifty-commit mailing list