From 3e4dc438e15757ab98250f8d9fd4e5ec9b81a04c Mon Sep 17 00:00:00 2001 From: Tom Quackenbush Date: Fri, 25 Feb 2011 13:02:43 -0500 Subject: [PATCH 1/2] Add attr_reader for setup_url on SetupNeededResponse. Add asserts to setup_needed tests to verify setup_url in response. --- lib/openid/consumer/responses.rb | 2 ++ test/test_consumer.rb | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/openid/consumer/responses.rb b/lib/openid/consumer/responses.rb index 4947c1ca..89a551fb 100644 --- a/lib/openid/consumer/responses.rb +++ b/lib/openid/consumer/responses.rb @@ -139,6 +139,8 @@ def initialize(endpoint) class SetupNeededResponse include Response STATUS = SETUP_NEEDED + + attr_reader :setup_url def initialize(endpoint, setup_url) @endpoint = endpoint @setup_url = setup_url diff --git a/test/test_consumer.rb b/test/test_consumer.rb index dc4a09e6..da485f4d 100644 --- a/test/test_consumer.rb +++ b/test/test_consumer.rb @@ -182,9 +182,11 @@ def test_setup_needed_openid1 end def test_setup_needed_openid2 - args = {'openid.ns' => OPENID2_NS, 'openid.mode' => 'setup_needed'} + setup_url = 'http://setup.url/' + args = {'openid.ns' => OPENID2_NS, 'openid.mode' => 'setup_needed', 'openid.user_setup_url' => setup_url} response = @consumer.complete(args, nil) assert_equal(SETUP_NEEDED, response.status) + assert_equal(setup_url, response.setup_url) end def test_idres_setup_needed_openid1 @@ -195,6 +197,7 @@ def test_idres_setup_needed_openid1 } response = @consumer.complete(args, nil) assert_equal(SETUP_NEEDED, response.status) + assert_equal(setup_url, response.setup_url) end def test_error From 4ce1cee5f7e861f64d7ca5550934f56971d031a3 Mon Sep 17 00:00:00 2001 From: Tom Quackenbush Date: Fri, 25 Feb 2011 13:13:28 -0500 Subject: [PATCH 2/2] Add missing testutil requires causing test suite to crash (at least under my install of OSX 10.6) --- test/test_accept.rb | 1 + test/test_association.rb | 1 + test/test_associationmanager.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/test/test_accept.rb b/test/test_accept.rb index 06db85bf..f4096009 100644 --- a/test/test_accept.rb +++ b/test/test_accept.rb @@ -3,6 +3,7 @@ require 'openid/yadis/accept' require 'openid/extras' require 'openid/util' +require 'testutil' module OpenID diff --git a/test/test_association.rb b/test/test_association.rb index 1b273321..35c28560 100644 --- a/test/test_association.rb +++ b/test/test_association.rb @@ -1,5 +1,6 @@ require "test/unit" require "openid/association" +require 'testutil' module OpenID class AssociationTestCase < Test::Unit::TestCase diff --git a/test/test_associationmanager.rb b/test/test_associationmanager.rb index 041449ff..2f981c5a 100644 --- a/test/test_associationmanager.rb +++ b/test/test_associationmanager.rb @@ -8,6 +8,7 @@ require "test/unit" require "util" require "time" +require 'testutil' module OpenID class DHAssocSessionTest < Test::Unit::TestCase