Skip to content

Commit

Permalink
Adding test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sanak authored and Redmine Patch Meetup committed Nov 24, 2022
1 parent c23d842 commit 8113206
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/integration/api_test/projects_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ def setup
assert_select 'issue_custom_fields[type=array] custom_field[name="Project 1 cf"]'
end

test "GET /projects.xml with include=issue_custom_fields should return custom fields based on role-based permissioning" do
field = IssueCustomField.find_by_name('Database')
field.update_attribute(:roles, [Role.find(1)])
# field.roles.push(Role.find(1))

user = User.find_by(:login => 'dlopper')
get '/projects.xml?include=issue_custom_fields', :headers => credentials(user.login)
assert_response :success
assert_equal 'application/xml', @response.media_type

assert_select 'issue_custom_fields[type=array] custom_field[name="Searchable field"]'
assert_select 'issue_custom_fields[type=array] custom_field[name="Database"]'
assert_select 'issue_custom_fields[type=array] custom_field[name="Float field"]'
assert_select 'issue_custom_fields[type=array] custom_field[name="Custom date"]'
assert_select 'issue_custom_fields[type=array] custom_field[name="Project 1 cf"]'
end

test "GET /projects/:id.xml should return the project" do
Project.find(1).update!(:inherit_members => '1')

Expand Down

0 comments on commit 8113206

Please sign in to comment.