Commit 9ee7286f authored by jplang's avatar jplang

REST API: option to get the project activities for time entries (#7506).

git-svn-id: https://svn.redmine.org/redmine/trunk@16365 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 17924041
......@@ -120,11 +120,16 @@ module ProjectsHelper
end
end if include_in_api_response?('issue_categories')
api.array :time_entry_activities do
project.activities.each do |activity|
api.time_entry_activity(:id => activity.id, :name => activity.name)
end
end if include_in_api_response?('time_entry_activities')
api.array :enabled_modules do
project.enabled_modules.each do |enabled_module|
api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
end
end if include_in_api_response?('enabled_modules')
end
end
......@@ -114,6 +114,14 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]'
end
test "GET /projects/:id.xml with include=time_entry_activities should return activities" do
get '/projects/1.xml?include=time_entry_activities'
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_select 'time_entry_activities[type=array] time_entry_activity[id="10"][name=Development]'
end
test "GET /projects/:id.xml with include=trackers should return trackers" do
get '/projects/1.xml?include=trackers'
assert_response :success
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment