]> source.dussan.org Git - redmine.git/commitdiff
Adds a test for adding a group membership with the REST API (#17904).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 4 Oct 2014 09:46:50 +0000 (09:46 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 4 Oct 2014 09:46:50 +0000 (09:46 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13426 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/integration/api_test/memberships_test.rb

index 544626592968f759009d553aa0520e7cd3b04c53..7ad0c5790a94ab580353b87ed40a207e9b4272fe 100644 (file)
@@ -89,6 +89,16 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base
     end
   end
 
+  test "POST /projects/:project_id/memberships.xml should create the group membership" do
+    group = Group.find(11)
+
+    assert_difference 'Member.count', 1 + group.users.count do
+      post '/projects/1/memberships.xml', {:membership => {:user_id => 11, :role_ids => [2,3]}}, credentials('jsmith')
+
+      assert_response :created
+    end
+  end
+
   test "POST /projects/:project_id/memberships.xml with invalid parameters should return errors" do
     assert_no_difference 'Member.count' do
       post '/projects/1/memberships.xml', {:membership => {:role_ids => [2,3]}}, credentials('jsmith')