X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0c7c950149888777e186e2eb7525b37f340bc6f0..fe96c0a524c9ce092eed8e8ac14e6f9309e778cc:/test/integration/user_creation_test.rb diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index beb05a98a..1b0933d32 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -56,7 +56,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :display_name => display_name, :pass_crypt => "testtest", :pass_crypt_confirmation => "testtest", - :auth_provider => "auth_provider", + :auth_provider => "google", :auth_uid => "123454321", :consider_pd => "1" } } end @@ -116,7 +116,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest post "/user/new", :params => { :user => { :email => email, :display_name => dup_display_name, - :auth_provider => "provider", + :auth_provider => "google", :auth_uid => "123454321", :consider_pd => "1" } } end @@ -234,6 +234,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_openid_success new_email = "newtester-openid@osm.org" display_name = "new_tester-openid" + openid_url = "http://localhost:1000/new.tester" auth_uid = "http://localhost:1123/new.tester" OmniAuth.config.add_mock(:openid, @@ -243,8 +244,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count") do assert_difference("ActionMailer::Base.deliveries.size", 1) do perform_enqueued_jobs do - post auth_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new") - assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new") + post auth_path(:provider => "openid", :openid_url => openid_url, :origin => "/user/new") + assert_redirected_to auth_success_path(:provider => "openid", :openid_url => openid_url, :origin => "/user/new") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, :email => new_email, :auth_provider => "openid", :auth_uid => auth_uid @@ -253,7 +254,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "openid", - :auth_uid => "http://localhost:1123/new.tester", + :auth_uid => auth_uid, :consider_pd => "1" } } end end @@ -307,7 +308,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest end def test_user_create_openid_redirect - auth_uid = "12345654321" + openid_url = "http://localhost:1000/new.tester" + auth_uid = "http://localhost:1123/new.tester" new_email = "redirect_tester_openid@osm.org" display_name = "redirect_tester_openid" @@ -318,8 +320,8 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count") do assert_difference("ActionMailer::Base.deliveries.size", 1) do perform_enqueued_jobs do - post auth_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new") - assert_redirected_to auth_success_path(:provider => "openid", :openid_url => "http://localhost:1123/new.tester", :origin => "/user/new") + post auth_path(:provider => "openid", :openid_url => openid_url, :origin => "/user/new") + assert_redirected_to auth_success_path(:provider => "openid", :openid_url => openid_url, :origin => "/user/new") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, :email => new_email, :auth_provider => "openid", :auth_uid => auth_uid @@ -366,7 +368,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_google_success new_email = "newtester-google@osm.org" - verified_email = UsersController.message_hmac(new_email) + email_hmac = UsersController.message_hmac(new_email) display_name = "new_tester-google" auth_uid = "123454321" @@ -382,7 +384,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "google") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => new_email, :verified_email => verified_email, + :email => new_email, :email_hmac => email_hmac, :auth_provider => "google", :auth_uid => auth_uid follow_redirect! @@ -392,7 +394,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "google", :auth_uid => auth_uid, :consider_pd => "1" }, - :verified_email => verified_email } + :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! end @@ -420,7 +422,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "google") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, :email => dup_user.email, - :verified_email => UsersController.message_hmac(dup_user.email), + :email_hmac => UsersController.message_hmac(dup_user.email), :auth_provider => "google", :auth_uid => auth_uid follow_redirect! @@ -452,7 +454,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_google_redirect orig_email = "redirect_tester_google_orig@google.com" - verified_email = UsersController.message_hmac(orig_email) + email_hmac = UsersController.message_hmac(orig_email) new_email = "redirect_tester_google@osm.org" display_name = "redirect_tester_google" auth_uid = "123454321" @@ -469,12 +471,12 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "google") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => orig_email, :verified_email => verified_email, + :email => orig_email, :email_hmac => email_hmac, :auth_provider => "google", :auth_uid => auth_uid follow_redirect! post "/user/new", :params => { :user => { :email => new_email, - :verified_email => verified_email, + :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "google", :auth_uid => auth_uid, @@ -516,7 +518,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_facebook_success new_email = "newtester-facebook@osm.org" - verified_email = UsersController.message_hmac(new_email) + email_hmac = UsersController.message_hmac(new_email) display_name = "new_tester-facebook" auth_uid = "123454321" @@ -531,7 +533,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "facebook") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => new_email, :verified_email => verified_email, + :email => new_email, :email_hmac => email_hmac, :auth_provider => "facebook", :auth_uid => auth_uid follow_redirect! @@ -541,7 +543,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "facebook", :auth_uid => auth_uid, :consider_pd => "1" }, - :verified_email => verified_email } + :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! end @@ -568,7 +570,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "facebook") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, :email => dup_user.email, - :verified_email => UsersController.message_hmac(dup_user.email), + :email_hmac => UsersController.message_hmac(dup_user.email), :auth_provider => "facebook", :auth_uid => auth_uid follow_redirect! @@ -600,7 +602,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_facebook_redirect orig_email = "redirect_tester_facebook_orig@osm.org" - verified_email = UsersController.message_hmac(orig_email) + email_hmac = UsersController.message_hmac(orig_email) new_email = "redirect_tester_facebook@osm.org" display_name = "redirect_tester_facebook" auth_uid = "123454321" @@ -617,13 +619,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "facebook") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => orig_email, :verified_email => verified_email, + :email => orig_email, :email_hmac => email_hmac, :auth_provider => "facebook", :auth_uid => auth_uid follow_redirect! post "/user/new", :params => { :user => { :email => new_email, - :verified_email => verified_email, + :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "facebook", :auth_uid => auth_uid, @@ -665,7 +667,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_microsoft_success new_email = "newtester-microsoft@osm.org" - verified_email = UsersController.message_hmac(new_email) + email_hmac = UsersController.message_hmac(new_email) display_name = "new_tester-microsoft" auth_uid = "123454321" @@ -680,7 +682,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "microsoft") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => new_email, :verified_email => verified_email, + :email => new_email, :email_hmac => email_hmac, :auth_provider => "microsoft", :auth_uid => auth_uid follow_redirect! post "/user/new", @@ -689,7 +691,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "microsoft", :auth_uid => auth_uid, :consider_pd => "1" }, - :verified_email => verified_email } + :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! end @@ -716,7 +718,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "microsoft") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, :email => dup_user.email, - :verified_email => UsersController.message_hmac(dup_user.email), + :email_hmac => UsersController.message_hmac(dup_user.email), :auth_provider => "microsoft", :auth_uid => auth_uid follow_redirect! @@ -748,7 +750,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_microsoft_redirect orig_email = "redirect_tester_microsoft_orig@osm.org" - verified_email = UsersController.message_hmac(orig_email) + email_hmac = UsersController.message_hmac(orig_email) new_email = "redirect_tester_microsoft@osm.org" display_name = "redirect_tester_microsoft" auth_uid = "123454321" @@ -764,13 +766,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "microsoft") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => orig_email, :verified_email => verified_email, + :email => orig_email, :email_hmac => email_hmac, :auth_provider => "microsoft", :auth_uid => auth_uid follow_redirect! post "/user/new", :params => { :user => { :email => new_email, - :verified_email => verified_email, + :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "microsoft", :auth_uid => auth_uid, @@ -812,7 +814,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_github_success new_email = "newtester-github@osm.org" - verified_email = UsersController.message_hmac(new_email) + email_hmac = UsersController.message_hmac(new_email) display_name = "new_tester-github" password = "testtest" auth_uid = "123454321" @@ -828,7 +830,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => new_email, :verified_email => verified_email, + :email => new_email, :email_hmac => email_hmac, :auth_provider => "github", :auth_uid => auth_uid follow_redirect! @@ -841,7 +843,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :pass_crypt_confirmation => password }, :read_ct => 1, :read_tou => 1, - :verified_email => verified_email } + :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! end @@ -869,7 +871,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => dup_user.email, :verified_email => UsersController.message_hmac(dup_user.email), + :email => dup_user.email, :email_hmac => UsersController.message_hmac(dup_user.email), :auth_provider => "github", :auth_uid => auth_uid follow_redirect! @@ -900,7 +902,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_github_redirect orig_email = "redirect_tester_github_orig@osm.org" - verified_email = UsersController.message_hmac(orig_email) + email_hmac = UsersController.message_hmac(orig_email) new_email = "redirect_tester_github@osm.org" display_name = "redirect_tester_github" auth_uid = "123454321" @@ -916,12 +918,12 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "github") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => orig_email, :verified_email => verified_email, + :email => orig_email, :email_hmac => email_hmac, :auth_provider => "github", :auth_uid => auth_uid follow_redirect! post "/user/new", :params => { :user => { :email => new_email, - :verified_email => verified_email, + :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "github", :auth_uid => auth_uid, @@ -963,7 +965,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_wikipedia_success new_email = "newtester-wikipedia@osm.org" - verified_email = UsersController.message_hmac(new_email) + email_hmac = UsersController.message_hmac(new_email) display_name = "new_tester-wikipedia" password = "testtest" auth_uid = "123454321" @@ -979,7 +981,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => new_email, :verified_email => verified_email, + :email => new_email, :email_hmac => email_hmac, :auth_provider => "wikipedia", :auth_uid => auth_uid follow_redirect! post "/user/new", @@ -991,7 +993,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :pass_crypt_confirmation => password }, :read_ct => 1, :read_tou => 1, - :verified_email => verified_email } + :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! end @@ -1016,7 +1018,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => dup_user.email, :verified_email => UsersController.message_hmac(dup_user.email), + :email => dup_user.email, :email_hmac => UsersController.message_hmac(dup_user.email), :auth_provider => "wikipedia", :auth_uid => auth_uid follow_redirect! @@ -1048,7 +1050,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest def test_user_create_wikipedia_redirect orig_email = "redirect_tester_wikipedia_orig@osm.org" - verified_email = UsersController.message_hmac(orig_email) + email_hmac = UsersController.message_hmac(orig_email) new_email = "redirect_tester_wikipedia@osm.org" display_name = "redirect_tester_wikipedia" auth_uid = "123454321" @@ -1065,13 +1067,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new") follow_redirect! assert_redirected_to :controller => :users, :action => "new", :nickname => display_name, - :email => orig_email, :verified_email => verified_email, + :email => orig_email, :email_hmac => email_hmac, :auth_provider => "wikipedia", :auth_uid => auth_uid follow_redirect! post "/user/new", :params => { :user => { :email => new_email, - :verified_email => verified_email, + :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "wikipedia", :auth_uid => auth_uid,