X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/113506bf5159bd06c218653a7d30d5a3c8d5c4e1..d3e91a79ff3ab35006b233d39e059ffa406ba443:/test/integration/user_login_test.rb diff --git a/test/integration/user_login_test.rb b/test/integration/user_login_test.rb index 0470ad842..2c3e61be6 100644 --- a/test/integration/user_login_test.rb +++ b/test/integration/user_login_test.rb @@ -113,7 +113,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_email_password_suspended_upcase @@ -123,7 +125,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_email_password_suspended_titlecase @@ -133,7 +137,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_email_password_blocked @@ -264,7 +270,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_username_password_suspended_upcase @@ -274,7 +282,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_username_password_suspended_downcase @@ -284,7 +294,9 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "login" assert_select "span.username", false - assert_select "div.flash.error", /your account has been suspended/ + assert_select "div.flash.error", /your account has been suspended/ do + assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster" + end end def test_login_username_password_blocked @@ -341,13 +353,13 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.add_mock(:openid, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success assert_template "user/login" - post "/login", :openid_url => "http://localhost:1123/john.doe", :referer => "/history" + post "/login", :params => { :openid_url => "http://localhost:1123/john.doe", :referer => "/history" } assert_response :redirect assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/john.doe", :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -365,13 +377,13 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.add_mock(:openid, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success assert_template "user/login" - post "/login", :openid_url => user.auth_uid, :remember_me_openid => true, :referer => "/history" + post "/login", :params => { :openid_url => user.auth_uid, :remember_me_openid => true, :referer => "/history" } assert_response :redirect assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -390,13 +402,13 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.mock_auth[:openid] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success assert_template "user/login" - post "/login", :openid_url => user.auth_uid, :referer => "/history" + post "/login", :params => { :openid_url => user.auth_uid, :referer => "/history" } assert_response :redirect assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -418,13 +430,13 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "openid", :auth_uid => "http://example.com/john.doe") OmniAuth.config.mock_auth[:openid] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success assert_template "user/login" - post "/login", :openid_url => user.auth_uid, :referer => "/history" + post "/login", :params => { :openid_url => user.auth_uid, :referer => "/history" } assert_response :redirect assert_redirected_to auth_path(:provider => "openid", :openid_url => user.auth_uid, :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -445,13 +457,13 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_openid_unknown OmniAuth.config.add_mock(:openid, :uid => "http://localhost:1123/fred.bloggs") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to :controller => :user, :action => :login, :cookie_test => true, :referer => "/history" follow_redirect! assert_response :success assert_template "user/login" - post "/login", :openid_url => "http://localhost:1123/fred.bloggs", :referer => "/history" + post "/login", :params => { :openid_url => "http://localhost:1123/fred.bloggs", :referer => "/history" } assert_response :redirect assert_redirected_to auth_path(:provider => "openid", :openid_url => "http://localhost:1123/fred.bloggs", :origin => "/login?referer=%2Fhistory", :referer => "/history") follow_redirect! @@ -471,7 +483,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest :id_info => { "openid_id" => "http://localhost:1123/fred.bloggs" } }) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -491,7 +503,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_google_connection_failed OmniAuth.config.mock_auth[:google] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -515,7 +527,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_google_invalid_credentials OmniAuth.config.mock_auth[:google] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -541,7 +553,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest :id_info => { "openid_id" => "http://localhost:1123/fred.bloggs" } }) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -564,7 +576,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest :id_info => { "openid_id" => user.auth_uid } }) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -589,7 +601,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "facebook", :auth_uid => "1234567890") OmniAuth.config.add_mock(:facebook, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -609,7 +621,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_facebook_connection_failed OmniAuth.config.mock_auth[:facebook] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -633,7 +645,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_facebook_invalid_credentials OmniAuth.config.mock_auth[:facebook] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -657,7 +669,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_facebook_unknown OmniAuth.config.add_mock(:facebook, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -678,7 +690,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "windowslive", :auth_uid => "1234567890") OmniAuth.config.add_mock(:windowslive, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -698,7 +710,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_windowslive_connection_failed OmniAuth.config.mock_auth[:windowslive] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -722,7 +734,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_windowslive_invalid_credentials OmniAuth.config.mock_auth[:windowslive] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -746,7 +758,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_windowslive_unknown OmniAuth.config.add_mock(:windowslive, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -767,7 +779,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "github", :auth_uid => "1234567890") OmniAuth.config.add_mock(:github, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -775,7 +787,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "user/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect follow_redirect! @@ -787,7 +799,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_github_connection_failed OmniAuth.config.mock_auth[:github] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -795,7 +807,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "user/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect assert_redirected_to auth_failure_path(:strategy => "github", :message => "connection_failed", :origin => "/login?referer=%2Fhistory") @@ -811,7 +823,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_github_invalid_credentials OmniAuth.config.mock_auth[:github] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -819,7 +831,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "user/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect assert_redirected_to auth_failure_path(:strategy => "github", :message => "invalid_credentials", :origin => "/login?referer=%2Fhistory") @@ -835,7 +847,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_github_unknown OmniAuth.config.add_mock(:github, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -843,7 +855,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_template "user/login" get auth_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") assert_response :redirect - assert_redirected_to auth_success_path(:provider => "github", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_response :redirect follow_redirect! @@ -856,7 +868,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest user = create(:user, :auth_provider => "wikipedia", :auth_uid => "1234567890") OmniAuth.config.add_mock(:wikipedia, :uid => user.auth_uid) - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -876,7 +888,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_wikipedia_connection_failed OmniAuth.config.mock_auth[:wikipedia] = :connection_failed - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -900,7 +912,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_wikipedia_invalid_credentials OmniAuth.config.mock_auth[:wikipedia] = :invalid_credentials - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -924,7 +936,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest def test_login_wikipedia_unknown OmniAuth.config.add_mock(:wikipedia, :uid => "987654321") - get "/login", :referer => "/history" + get "/login", :params => { :referer => "/history" } assert_response :redirect assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" follow_redirect! @@ -960,7 +972,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_select "[checked]", false end - post "/login", :username => username, :password => "wrong", :remember_me => remember_me, :referer => "/history" + post "/login", :params => { :username => username, :password => "wrong", :remember_me => remember_me, :referer => "/history" } assert_response :redirect follow_redirect! assert_response :success @@ -975,7 +987,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_select "[checked]", remember_me == "yes" end - post "/login", :username => username, :password => password, :remember_me => remember_me, :referer => "/history" + post "/login", :params => { :username => username, :password => password, :remember_me => remember_me, :referer => "/history" } assert_response :redirect follow_redirect! assert_response :success