From ab20ca90fcc3f5f152df90600fd265b2b83a87bc Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Sat, 15 Jan 2022 16:20:23 +0900 Subject: [PATCH] Adding test case --- test/integration/api_test/projects_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index d0b4b36c5..11b4b7f5a 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.rb @@ -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')