X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c486dd5532d2b826759becfad417670219ede19b..f8ad4c79a4c1880370a035be0c0286a9b4285a69:/test/integration/user_creation_test.rb diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index 59eb9ae30..1a53f62da 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -30,7 +30,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count", 0) do assert_difference("ActionMailer::Base.deliveries.size", 0) do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => dup_email, :display_name => display_name, :pass_crypt => "testtest", @@ -51,12 +51,12 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count", 0) do assert_no_difference("ActionMailer::Base.deliveries.size") do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => dup_email, :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 @@ -74,7 +74,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count", 0) do assert_difference("ActionMailer::Base.deliveries.size", 0) do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => email, :display_name => dup_display_name, :pass_crypt => "testtest", @@ -93,7 +93,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count", 0) do assert_difference("ActionMailer::Base.deliveries.size", 0) do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => email, :display_name => display_name, :pass_crypt => "testtest", @@ -113,10 +113,10 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count", 0) do assert_no_difference("ActionMailer::Base.deliveries.size") do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => email, :display_name => dup_display_name, - :auth_provider => "provider", + :auth_provider => "google", :auth_uid => "123454321", :consider_pd => "1" } } end @@ -134,7 +134,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count", 1) do assert_difference("ActionMailer::Base.deliveries.size", 1) do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :pass_crypt => "testtest", @@ -171,13 +171,13 @@ class UserCreationTest < ActionDispatch::IntegrationTest end # Check that the user can successfully recover their password - def test_lost_password_recovery_success - # Open the lost password form - # Submit the lost password form - # Check the e-mail - # Submit the reset password token - # Check that the password has changed, and the user can login - end + # def test_lost_password_recovery_success + # Open the lost password form + # Submit the lost password form + # Check the e-mail + # Submit the reset password token + # Check that the password has changed, and the user can login + # end def test_user_create_redirect new_email = "redirect_tester@osm.org" @@ -188,7 +188,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_difference("User.count") do assert_difference("ActionMailer::Base.deliveries.size", 1) do perform_enqueued_jobs do - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :pass_crypt => password, @@ -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,17 +244,17 @@ 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 follow_redirect! - post "/user/new", + post "/user", :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,13 +320,13 @@ 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 follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "openid", @@ -386,7 +388,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "google", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "google", @@ -472,7 +474,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email => orig_email, :email_hmac => email_hmac, :auth_provider => "google", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :email_hmac => email_hmac, :display_name => display_name, @@ -535,7 +537,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "facebook", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "facebook", @@ -621,7 +623,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "facebook", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :email_hmac => email_hmac, :display_name => display_name, @@ -683,7 +685,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email => new_email, :email_hmac => email_hmac, :auth_provider => "microsoft", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "microsoft", @@ -768,7 +770,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "microsoft", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :email_hmac => email_hmac, :display_name => display_name, @@ -832,7 +834,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "github", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "github", @@ -919,7 +921,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email => orig_email, :email_hmac => email_hmac, :auth_provider => "github", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :email_hmac => email_hmac, :display_name => display_name, @@ -982,7 +984,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email => new_email, :email_hmac => email_hmac, :auth_provider => "wikipedia", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "wikipedia", @@ -1069,7 +1071,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :auth_provider => "wikipedia", :auth_uid => auth_uid follow_redirect! - post "/user/new", + post "/user", :params => { :user => { :email => new_email, :email_hmac => email_hmac, :display_name => display_name,