# Login as an unprivileged user
session[:user] = users(:public_user).id
- cookies["_osm_username"] = users(:public_user).display_name
# Granting should still fail
post :grant, :display_name => users(:normal_user).display_name, :role => "moderator"
# Login as an administrator
session[:user] = users(:administrator_user).id
- cookies["_osm_username"] = users(:administrator_user).display_name
UserRole::ALL_ROLES.each do |role|
end
assert_response :not_found
assert_template "user/no_such_user"
- assert_select "h2", "The user non_existent_user does not exist"
+ assert_select "h1", "The user non_existent_user does not exist"
# Granting a role from a user that already has it should fail
assert_no_difference "UserRole.count" do
# Login as an unprivileged user
session[:user] = users(:public_user).id
- cookies["_osm_username"] = users(:public_user).display_name
# Revoking should still fail
post :revoke, :display_name => users(:normal_user).display_name, :role => "moderator"
# Login as an administrator
session[:user] = users(:administrator_user).id
- cookies["_osm_username"] = users(:administrator_user).display_name
UserRole::ALL_ROLES.each do |role|
end
assert_response :not_found
assert_template "user/no_such_user"
- assert_select "h2", "The user non_existent_user does not exist"
+ assert_select "h1", "The user non_existent_user does not exist"
# Removing a role from a user that doesn't have it should fail
assert_no_difference "UserRole.count" do