create_list(:oauth_application, 2, :owner => user)
get oauth_applications_path
- assert_response :redirect
assert_redirected_to login_path(:referer => oauth_applications_path)
session_for(user)
assert_select "tbody tr", 2
end
+ def test_index_with_moderator_app
+ user = create(:user)
+ create(:oauth_application, :owner => user, :scopes => "write_redactions")
+
+ session_for(user)
+
+ get oauth_applications_path
+ assert_response :success
+ end
+
def test_new
user = create(:user)
get new_oauth_application_path
- assert_response :redirect
assert_redirected_to login_path(:referer => new_oauth_application_path)
session_for(user)
:scopes => ["read_prefs"]
})
end
- assert_response :redirect
assert_redirected_to oauth_application_path(:id => Doorkeeper::Application.find_by(:name => "Test Application").id)
end
:scopes => ["read_email"]
})
end
- assert_response :redirect
assert_redirected_to oauth_application_path(:id => Doorkeeper::Application.find_by(:name => "Test Application").id)
end
other_client = create(:oauth_application)
get oauth_application_path(:id => client)
- assert_response :redirect
assert_redirected_to login_path(:referer => oauth_application_path(:id => client.id))
session_for(user)
other_client = create(:oauth_application)
get edit_oauth_application_path(:id => client)
- assert_response :redirect
assert_redirected_to login_path(:referer => edit_oauth_application_path(:id => client.id))
session_for(user)
:name => "New Name",
:redirect_uri => "https://new.example.com/url"
})
- assert_response :redirect
assert_redirected_to oauth_application_path(:id => client.id)
end
assert_difference "Doorkeeper::Application.count", -1 do
delete oauth_application_path(:id => client)
end
- assert_response :redirect
assert_redirected_to oauth_applications_path
end
end