Class: OpenIdAuthenticationTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- OpenIdAuthenticationTest
- Defined in:
- vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb
Instance Method Summary
- - (Object) setup
- - (Object) test_authentication_should_be_invalid_when_the_identity_url_is_invalid
- - (Object) test_authentication_should_begin_when_the_identity_server_is_present
- - (Object) test_authentication_should_fail_when_the_identity_server_is_missing
- - (Object) test_authentication_should_fail_when_the_identity_server_times_out
Instance Method Details
- (Object) setup
4 5 6 7 8 9 |
# File 'vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb', line 4 def setup @controller = Class.new do include OpenIdAuthentication def params() {} end end.new end |
- (Object) test_authentication_should_be_invalid_when_the_identity_url_is_invalid
23 24 25 26 27 28 |
# File 'vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb', line 23 def test_authentication_should_be_invalid_when_the_identity_url_is_invalid @controller.send(:authenticate_with_open_id, "!") do |result, identity_url| assert result.invalid?, "Result expected to be invalid but was not" assert_equal "Sorry, but this does not appear to be a valid OpenID", result. end end |
- (Object) test_authentication_should_begin_when_the_identity_server_is_present
42 43 44 45 |
# File 'vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb', line 42 def test_authentication_should_begin_when_the_identity_server_is_present @controller.expects(:begin_open_id_authentication) @controller.send(:authenticate_with_open_id, "http://someone.example.com") end |
- (Object) test_authentication_should_fail_when_the_identity_server_is_missing
11 12 13 14 15 16 17 18 19 20 21 |
# File 'vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb', line 11 def test_authentication_should_fail_when_the_identity_server_is_missing open_id_consumer = mock() open_id_consumer.expects(:begin).raises(OpenID::OpenIDError) @controller.expects(:open_id_consumer).returns(open_id_consumer) @controller.expects(:logger).returns(mock(:error => true)) @controller.send(:authenticate_with_open_id, "http://someone.example.com") do |result, identity_url| assert result.missing? assert_equal "Sorry, the OpenID server couldn't be found", result. end end |
- (Object) test_authentication_should_fail_when_the_identity_server_times_out
30 31 32 33 34 35 36 37 38 39 40 |
# File 'vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb', line 30 def test_authentication_should_fail_when_the_identity_server_times_out open_id_consumer = mock() open_id_consumer.expects(:begin).raises(Timeout::Error, "Identity Server took too long.") @controller.expects(:open_id_consumer).returns(open_id_consumer) @controller.expects(:logger).returns(mock(:error => true)) @controller.send(:authenticate_with_open_id, "http://someone.example.com") do |result, identity_url| assert result.missing? assert_equal "Sorry, the OpenID server couldn't be found", result. end end |