create_list(:access_token, 2, :user => user)
get oauth_clients_path(:display_name => user.display_name)
- assert_response :redirect
assert_redirected_to login_path(:referer => oauth_clients_path(:display_name => user.display_name))
session_for(user)
user = create(:user)
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)
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_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_redirected_to oauth_clients_path(:display_name => user.display_name)
+ end
+ end
+
def test_create
user = create(:user)
:client_application => { :name => "Test Application",
:url => "http://test.example.com/" })
end
- assert_response :redirect
assert_redirected_to oauth_client_path(:id => ClientApplication.find_by(:name => "Test Application").id)
end
other_client = create(:client_application)
get oauth_client_path(:display_name => user.display_name, :id => client)
- assert_response :redirect
assert_redirected_to login_path(:referer => oauth_client_path(:display_name => user.display_name, :id => client.id))
session_for(user)
other_client = create(:client_application)
get edit_oauth_client_path(:display_name => user.display_name, :id => client)
- assert_response :redirect
assert_redirected_to login_path(:referer => edit_oauth_client_path(:display_name => user.display_name, :id => client.id))
session_for(user)
put oauth_client_path(:display_name => user.display_name, :id => client,
:client_application => { :name => "New Name", :url => "http://new.example.com/url" })
- assert_response :redirect
assert_redirected_to oauth_client_path(:id => client.id)
end
assert_difference "ClientApplication.count", -1 do
delete oauth_client_path(:display_name => user.display_name, :id => client)
end
- assert_response :redirect
assert_redirected_to oauth_clients_path(:display_name => user.display_name)
end
end