]> git.openstreetmap.org Git - rails.git/blobdiff - test/integration/user_creation_test.rb
Merge branch 'pull/5030'
[rails.git] / test / integration / user_creation_test.rb
index 59eb9ae30853cedb502d98cf65a81e1e15094bfe..1b0933d32b0f9c760f704ba707e49362cdc7f5ff 100644 (file)
@@ -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