X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6335891a4c53c6db535dd059d7c76557abebef42..6213592a6a4e90df4008f6549bbea334cd19e816:/test/controllers/oauth_clients_controller_test.rb diff --git a/test/controllers/oauth_clients_controller_test.rb b/test/controllers/oauth_clients_controller_test.rb index 76f366e3d..81ab290b9 100644 --- a/test/controllers/oauth_clients_controller_test.rb +++ b/test/controllers/oauth_clients_controller_test.rb @@ -38,11 +38,14 @@ class OauthClientsControllerTest < ActionController::TestCase user = create(:user) create_list(:client_application, 2, :user => user) - get :index, :display_name => user.display_name + get :index, + :params => { :display_name => user.display_name } assert_response :redirect assert_redirected_to login_path(:referer => oauth_clients_path(:display_name => user.display_name)) - get :index, { :display_name => user.display_name }, { :user => user } + get :index, + :params => { :display_name => user.display_name }, + :session => { :user => user } assert_response :success assert_template "index" assert_select "div.client_application", 2 @@ -51,11 +54,14 @@ class OauthClientsControllerTest < ActionController::TestCase def test_new user = create(:user) - get :new, :display_name => user.display_name + get :new, + :params => { :display_name => user.display_name } assert_response :redirect assert_redirected_to login_path(:referer => new_oauth_client_path(:display_name => user.display_name)) - get :new, { :display_name => user.display_name }, { :user => user } + get :new, + :params => { :display_name => user.display_name }, + :session => { :user => user } assert_response :success assert_template "new" assert_select "form", 1 do @@ -73,29 +79,25 @@ class OauthClientsControllerTest < ActionController::TestCase user = create(:user) assert_difference "ClientApplication.count", 0 do - post :create, :display_name => user.display_name + post :create, :params => { :display_name => user.display_name } end assert_response :forbidden assert_difference "ClientApplication.count", 0 do - post :create, { - :display_name => user.display_name, - :client_application => { - :name => "Test Application" - } - }, { :user => user } + post :create, + :params => { :display_name => user.display_name, + :client_application => { :name => "Test Application" } }, + :session => { :user => user } end assert_response :success assert_template "new" assert_difference "ClientApplication.count", 1 do - post :create, { - :display_name => user.display_name, - :client_application => { - :name => "Test Application", - :url => "http://test.example.com/" - } - }, { :user => user } + post :create, + :params => { :display_name => user.display_name, + :client_application => { :name => "Test Application", + :url => "http://test.example.com/" } }, + :session => { :user => user } end assert_response :redirect assert_redirected_to oauth_client_path(:id => ClientApplication.find_by(:name => "Test Application").id) @@ -106,15 +108,20 @@ class OauthClientsControllerTest < ActionController::TestCase client = create(:client_application, :user => user) other_client = create(:client_application) - get :show, :display_name => user.display_name, :id => client.id + get :show, + :params => { :display_name => user.display_name, :id => client.id } assert_response :redirect assert_redirected_to login_path(:referer => oauth_client_path(:display_name => user.display_name, :id => client.id)) - get :show, { :display_name => user.display_name, :id => other_client.id }, { :user => user } + get :show, + :params => { :display_name => user.display_name, :id => other_client.id }, + :session => { :user => user } assert_response :not_found assert_template "not_found" - get :show, { :display_name => user.display_name, :id => client.id }, { :user => user } + get :show, + :params => { :display_name => user.display_name, :id => client.id }, + :session => { :user => user } assert_response :success assert_template "show" end @@ -124,15 +131,20 @@ class OauthClientsControllerTest < ActionController::TestCase client = create(:client_application, :user => user) other_client = create(:client_application) - get :edit, :display_name => user.display_name, :id => client.id + get :edit, + :params => { :display_name => user.display_name, :id => client.id } assert_response :redirect assert_redirected_to login_path(:referer => edit_oauth_client_path(:display_name => user.display_name, :id => client.id)) - get :edit, { :display_name => user.display_name, :id => other_client.id }, { :user => user } + get :edit, + :params => { :display_name => user.display_name, :id => other_client.id }, + :session => { :user => user } assert_response :not_found assert_template "not_found" - get :edit, { :display_name => user.display_name, :id => client.id }, { :user => user } + get :edit, + :params => { :display_name => user.display_name, :id => client.id }, + :session => { :user => user } assert_response :success assert_template "edit" assert_select "form", 1 do @@ -151,32 +163,29 @@ class OauthClientsControllerTest < ActionController::TestCase client = create(:client_application, :user => user) other_client = create(:client_application) - put :update, :display_name => user.display_name, :id => client.id + put :update, + :params => { :display_name => user.display_name, :id => client.id } assert_response :forbidden - put :update, { :display_name => user.display_name, :id => other_client.id }, { :user => user } + put :update, + :params => { :display_name => user.display_name, :id => other_client.id }, + :session => { :user => user } assert_response :not_found assert_template "not_found" - put :update, { - :display_name => user.display_name, - :id => client.id, - :client_application => { - :name => "New Name", - :url => nil - } - }, { :user => user } + put :update, + :params => { :display_name => user.display_name, + :id => client.id, + :client_application => { :name => "New Name", :url => nil } }, + :session => { :user => user } assert_response :success assert_template "edit" - put :update, { - :display_name => user.display_name, - :id => client.id, - :client_application => { - :name => "New Name", - :url => "http://new.example.com/url" - } - }, { :user => user } + put :update, + :params => { :display_name => user.display_name, + :id => client.id, + :client_application => { :name => "New Name", :url => "http://new.example.com/url" } }, + :session => { :user => user } assert_response :redirect assert_redirected_to oauth_client_path(:id => client.id) end @@ -187,18 +196,23 @@ class OauthClientsControllerTest < ActionController::TestCase other_client = create(:client_application) assert_difference "ClientApplication.count", 0 do - delete :destroy, :display_name => user.display_name, :id => client.id + delete :destroy, + :params => { :display_name => user.display_name, :id => client.id } end assert_response :forbidden assert_difference "ClientApplication.count", 0 do - delete :destroy, { :display_name => user.display_name, :id => other_client.id }, { :user => user } + delete :destroy, + :params => { :display_name => user.display_name, :id => other_client.id }, + :session => { :user => user } end assert_response :not_found assert_template "not_found" assert_difference "ClientApplication.count", -1 do - delete :destroy, { :display_name => user.display_name, :id => client.id }, { :user => user } + delete :destroy, + :params => { :display_name => user.display_name, :id => client.id }, + :session => { :user => user } end assert_response :redirect assert_redirected_to oauth_clients_path(:display_name => user.display_name)