]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/oauth_clients_controller_test.rb
Use rails tokens for password resets
[rails.git] / test / controllers / oauth_clients_controller_test.rb
index fb651ff3c8f5b6ffd68c3ef86dfbc74658ee2085..f106b4af6f1eff6de8d674f5f535c9f7ae857eff 100644 (file)
@@ -74,6 +74,22 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest
     end
   end
 
+  def test_new_disabled
+    user = create(:user)
+
+    with_settings(:oauth_10_registration => false) do
+      get new_oauth_client_path(:display_name => user.display_name)
+      assert_response :redirect
+      assert_redirected_to login_path(:referer => new_oauth_client_path(:display_name => user.display_name))
+
+      session_for(user)
+
+      get new_oauth_client_path(:display_name => user.display_name)
+      assert_response :redirect
+      assert_redirected_to oauth_clients_path(:display_name => user.display_name)
+    end
+  end
+
   def test_create
     user = create(:user)