mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 13:55:52 +01:00
Error when adding user to group where he is already assigned (#18665).
git-svn-id: http://svn.redmine.org/redmine/trunk@13785 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -185,6 +185,19 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
|
||||
assert_include User.find(5), Group.find(10).users
|
||||
end
|
||||
|
||||
test "POST /groups/:id/users.xml should not add the user if already added" do
|
||||
Group.find(10).users << User.find(5)
|
||||
|
||||
assert_no_difference 'Group.find(10).users.count' do
|
||||
post '/groups/10/users.xml', {:user_id => 5}, credentials('admin')
|
||||
assert_response :unprocessable_entity
|
||||
end
|
||||
|
||||
assert_select 'errors' do
|
||||
assert_select 'error', :text => /User is invalid/
|
||||
end
|
||||
end
|
||||
|
||||
test "DELETE /groups/:id/users/:user_id.xml should remove user from the group" do
|
||||
assert_difference 'Group.find(10).users.count', -1 do
|
||||
delete '/groups/10/users/8.xml', {}, credentials('admin')
|
||||
|
||||
Reference in New Issue
Block a user