summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-04 19:48:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-04 19:48:11 +0000
commit5e9e64038199a54e5c9c9b237c0e6d8cb14fd251 (patch)
tree9837dc1b60277155ae0c0c5c64acc9caeb2af0d7 /test/integration
parent01ab1edebeaf09a6c9fd620b2fe624ce57466300 (diff)
downloadredmine-5e9e64038199a54e5c9c9b237c0e6d8cb14fd251.tar.gz
redmine-5e9e64038199a54e5c9c9b237c0e6d8cb14fd251.zip
Merged r16116 (#22034).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16129 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/memberships_test.rb34
1 files changed, 20 insertions, 14 deletions
diff --git a/test/integration/api_test/memberships_test.rb b/test/integration/api_test/memberships_test.rb
index 92d4b094c..dd259839d 100644
--- a/test/integration/api_test/memberships_test.rb
+++ b/test/integration/api_test/memberships_test.rb
@@ -37,20 +37,17 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base
assert_response :success
assert_equal 'application/json', @response.content_type
json = ActiveSupport::JSON.decode(response.body)
- assert_equal({
- "memberships" =>
- [{"id"=>1,
- "project" => {"name"=>"eCookbook", "id"=>1},
- "roles" => [{"name"=>"Manager", "id"=>1}],
- "user" => {"name"=>"John Smith", "id"=>2}},
- {"id"=>2,
- "project" => {"name"=>"eCookbook", "id"=>1},
- "roles" => [{"name"=>"Developer", "id"=>2}],
- "user" => {"name"=>"Dave Lopper", "id"=>3}}],
- "limit" => 25,
- "total_count" => 2,
- "offset" => 0},
- json)
+ assert_equal 3, json["total_count"]
+ assert_equal 25, json["limit"]
+ assert_equal 0, json["offset"]
+ assert_include({
+ "id"=>1,
+ "project" => {"name"=>"eCookbook", "id"=>1},
+ "roles" => [{"name"=>"Manager", "id"=>1}],
+ "user" => {"name"=>"John Smith", "id"=>2}
+ },
+ json["memberships"]
+ )
end
test "GET /projects/:project_id/memberships.xml should succeed for closed project" do
@@ -61,6 +58,15 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base
assert_response :success
end
+ test "GET /projects/:project_id/memberships.xml should include locked users" do
+ assert User.find(3).lock!
+ get '/projects/ecookbook/memberships.xml', {}, credentials('jsmith')
+ assert_response :success
+ assert_select 'memberships[type=array] membership id', :text => '2' do
+ assert_select '~ user[id="3"][name="Dave Lopper"]'
+ end
+ end
+
test "POST /projects/:project_id/memberships.xml should create the membership" do
assert_difference 'Member.count' do
post '/projects/1/memberships.xml', {:membership => {:user_id => 7, :role_ids => [2,3]}}, credentials('jsmith')