From 7e7ac5340a281ed767066af0b5f4dd45a3d7076f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 28 Sep 2014 14:51:08 +0000 Subject: Adds buit-in groups to give specific permissions to anonymous and non members users per project (#17976). git-svn-id: http://svn.redmine.org/redmine/trunk@13417 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/extra/redmine_pm/repository_subversion_test.rb | 15 +++++++++++++++ test/extra/redmine_pm/test_case.rb | 1 + 2 files changed, 16 insertions(+) (limited to 'test/extra') diff --git a/test/extra/redmine_pm/repository_subversion_test.rb b/test/extra/redmine_pm/repository_subversion_test.rb index 81cf2b840..b40210467 100644 --- a/test/extra/redmine_pm/repository_subversion_test.rb +++ b/test/extra/redmine_pm/repository_subversion_test.rb @@ -27,6 +27,12 @@ class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase assert_success "ls", svn_url end + def test_anonymous_read_on_public_repo_with_anonymous_group_permission_should_succeed + Role.anonymous.remove_permission! :browse_repository + Member.create!(:project_id => 1, :principal => Group.anonymous, :role_ids => [2]) + assert_success "ls", svn_url + end + def test_anonymous_read_on_public_repo_without_permission_should_fail Role.anonymous.remove_permission! :browse_repository assert_failure "ls", svn_url @@ -55,6 +61,15 @@ class RedminePmTest::RepositorySubversionTest < RedminePmTest::TestCase end end + def test_non_member_read_on_public_repo_with_non_member_group_permission_should_succeed + Role.anonymous.remove_permission! :browse_repository + Role.non_member.remove_permission! :browse_repository + Member.create!(:project_id => 1, :principal => Group.non_member, :role_ids => [2]) + with_credentials "miscuser8", "foo" do + assert_success "ls", svn_url + end + end + def test_non_member_read_on_public_repo_without_permission_should_fail Role.anonymous.remove_permission! :browse_repository Role.non_member.remove_permission! :browse_repository diff --git a/test/extra/redmine_pm/test_case.rb b/test/extra/redmine_pm/test_case.rb index f1a6b92e8..d9d25bd65 100644 --- a/test/extra/redmine_pm/test_case.rb +++ b/test/extra/redmine_pm/test_case.rb @@ -65,6 +65,7 @@ module RedminePmTest @command = args.join(' ') @status = nil IO.popen("#{command} 2>&1") do |io| + io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding) @response = io.read end @status = $?.exitstatus -- cgit v1.2.3