summaryrefslogtreecommitdiffstats
path: root/test/extra/redmine_pm
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-09-28 14:51:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-09-28 14:51:08 +0000
commit7e7ac5340a281ed767066af0b5f4dd45a3d7076f (patch)
tree891640b0548c0d3063daddb219006d120fa312c3 /test/extra/redmine_pm
parent9a7fb0ad7be0ee3403f5b89eb0c16b68c991d519 (diff)
downloadredmine-7e7ac5340a281ed767066af0b5f4dd45a3d7076f.tar.gz
redmine-7e7ac5340a281ed767066af0b5f4dd45a3d7076f.zip
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
Diffstat (limited to 'test/extra/redmine_pm')
-rw-r--r--test/extra/redmine_pm/repository_subversion_test.rb15
-rw-r--r--test/extra/redmine_pm/test_case.rb1
2 files changed, 16 insertions, 0 deletions
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