summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-03-27 21:30:33 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-03-27 21:30:33 +0000
commitd3988aedd162b13b4c84941f6851f5abceb2af75 (patch)
treefb2af7fe0d5722a50090144197dd96c2f7393aca
parent883fcb89ee25649f75e94173a9a46cf5ff8af757 (diff)
downloadredmine-d3988aedd162b13b4c84941f6851f5abceb2af75.tar.gz
redmine-d3988aedd162b13b4c84941f6851f5abceb2af75.zip
Add test for #34029.
Patch by Vincent Robert. git-svn-id: https://svn.redmine.org/redmine/trunk@21503 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/system/issues_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb
index 935470e1a..2476dc43e 100644
--- a/test/system/issues_test.rb
+++ b/test/system/issues_test.rb
@@ -152,6 +152,28 @@ class IssuesSystemTest < ApplicationSystemTestCase
assert_equal 'Some description', issue.attachments.first.description
end
+ def test_create_issue_with_attachment_when_user_is_not_a_member
+ set_tmp_attachments_directory
+ # Set no permission to non-member role
+ non_member_role = Role.where(:builtin => Role::BUILTIN_NON_MEMBER).first
+ non_member_role.permissions = []
+ non_member_role.save
+ # Set role "Reporter" to non-member users on project ecookbook
+ membership = Member.find_or_create_by(user_id: Group.non_member.id, project_id: 1)
+ membership.roles = [Role.find(3)] # Reporter
+ membership.save
+ log_user('someone', 'foo')
+ issue = new_record(Issue) do
+ visit '/projects/ecookbook/issues/new'
+ fill_in 'Subject', :with => 'Issue with attachment'
+ attach_file 'attachments[dummy][file]', Rails.root.join('test/fixtures/files/testfile.txt')
+ fill_in 'attachments[1][description]', :with => 'Some description'
+ click_on 'Create'
+ end
+ assert_equal 1, issue.attachments.count
+ assert_equal 'Some description', issue.attachments.first.description
+ end
+
def test_create_issue_with_new_target_version
log_user('jsmith', 'jsmith')