diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-31 13:33:02 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-31 13:33:02 +0000 |
commit | 514d9bad9efd584d9dd70aca2b1c27128c2f0eca (patch) | |
tree | f7e88d67054fa130b3849222c68102ca6c4934d9 /test | |
parent | f2bf5aa25c482eb48d24135a19cb6f4455bf263f (diff) | |
download | redmine-514d9bad9efd584d9dd70aca2b1c27128c2f0eca.tar.gz redmine-514d9bad9efd584d9dd70aca2b1c27128c2f0eca.zip |
Fixed that project settings should show locked members (#22034).
git-svn-id: http://svn.redmine.org/redmine/trunk@16116 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/members_controller_test.rb | 18 | ||||
-rw-r--r-- | test/functional/projects_controller_test.rb | 12 | ||||
-rw-r--r-- | test/integration/api_test/memberships_test.rb | 34 |
3 files changed, 50 insertions, 14 deletions
diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb index c9337e210..d132c8293 100644 --- a/test/functional/members_controller_test.rb +++ b/test/functional/members_controller_test.rb @@ -117,6 +117,16 @@ class MembersControllerTest < Redmine::ControllerTest assert_redirected_to '/projects/ecookbook/settings/members' end + def test_update_locked_member_should_be_allowed + User.find(3).lock! + + put :update, :id => 2, :membership => {:role_ids => [1]} + assert_response 302 + member = Member.find(2) + assert member.user.locked? + assert_equal [1], member.role_ids + end + def test_update_should_not_add_unmanaged_roles role = Role.find(1) role.update! :all_roles_managed => false @@ -157,6 +167,14 @@ class MembersControllerTest < Redmine::ControllerTest assert !User.find(3).member_of?(Project.find(1)) end + def test_destroy_locked_member_should_be_allowed + assert User.find(3).lock! + + assert_difference 'Member.count', -1 do + delete :destroy, :id => 2 + end + end + def test_destroy_should_fail_with_unmanaged_roles role = Role.find(1) role.update! :all_roles_managed => false diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 01c68308f..da2818174 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -527,6 +527,18 @@ class ProjectsControllerTest < Redmine::ControllerTest assert_select 'a#tab-versions[href=?]', '/projects/ecookbook/settings/versions?version_name=.1&version_status=' end + def test_settings_should_show_locked_members + user = User.generate! + member = User.add_to_project(user, Project.find(1)) + user.lock! + assert user.reload.locked? + @request.session[:user_id] = 2 + + get :settings, :id => 'ecookbook', :tab => 'members' + assert_response :success + assert_select "tr#member-#{member.id}" + end + def test_update @request.session[:user_id] = 2 # manager post :update, :id => 1, :project => {:name => 'Test changed name', 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') |