@@ -16,4 +16,10 api.project do | |||
|
16 | 16 | api.tracker(:id => tracker.id, :name => tracker.name) |
|
17 | 17 | end |
|
18 | 18 | end if include_in_api_response?('trackers') |
|
19 | ||
|
20 | api.array :issue_categories do | |
|
21 | @project.issue_categories.each do |category| | |
|
22 | api.issue_category(:id => category.id, :name => category.name) | |
|
23 | end | |
|
24 | end if include_in_api_response?('issue_categories') | |
|
19 | 25 | end |
@@ -20,7 +20,7 require File.expand_path('../../../test_helper', __FILE__) | |||
|
20 | 20 | class ApiTest::ProjectsTest < ActionController::IntegrationTest |
|
21 | 21 | fixtures :projects, :versions, :users, :roles, :members, :member_roles, :issues, :journals, :journal_details, |
|
22 | 22 | :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations, :boards, :messages, |
|
23 | :attachments, :custom_fields, :custom_values, :time_entries | |
|
23 | :attachments, :custom_fields, :custom_values, :time_entries, :issue_categories | |
|
24 | 24 | |
|
25 | 25 | def setup |
|
26 | 26 | Setting.rest_api_enabled = '1' |
@@ -69,6 +69,9 class ApiTest::ProjectsTest < ActionController::IntegrationTest | |||
|
69 | 69 | :child => {:tag => 'id', :content => '1'} |
|
70 | 70 | assert_tag :tag => 'custom_field', |
|
71 | 71 | :attributes => {:name => 'Development status'}, :content => 'Stable' |
|
72 | ||
|
73 | assert_no_tag 'trackers' | |
|
74 | assert_no_tag 'issue_categories' | |
|
72 | 75 | end |
|
73 | 76 | |
|
74 | 77 | context "with hidden custom fields" do |
@@ -85,6 +88,38 class ApiTest::ProjectsTest < ActionController::IntegrationTest | |||
|
85 | 88 | :attributes => {:name => 'Development status'} |
|
86 | 89 | end |
|
87 | 90 | end |
|
91 | ||
|
92 | should "return categories with include=issue_categories" do | |
|
93 | get '/projects/1.xml?include=issue_categories' | |
|
94 | assert_response :success | |
|
95 | assert_equal 'application/xml', @response.content_type | |
|
96 | ||
|
97 | assert_tag 'issue_categories', | |
|
98 | :attributes => {:type => 'array'}, | |
|
99 | :child => { | |
|
100 | :tag => 'issue_category', | |
|
101 | :attributes => { | |
|
102 | :id => '2', | |
|
103 | :name => 'Recipes' | |
|
104 | } | |
|
105 | } | |
|
106 | end | |
|
107 | ||
|
108 | should "return trackers with include=trackers" do | |
|
109 | get '/projects/1.xml?include=trackers' | |
|
110 | assert_response :success | |
|
111 | assert_equal 'application/xml', @response.content_type | |
|
112 | ||
|
113 | assert_tag 'trackers', | |
|
114 | :attributes => {:type => 'array'}, | |
|
115 | :child => { | |
|
116 | :tag => 'tracker', | |
|
117 | :attributes => { | |
|
118 | :id => '2', | |
|
119 | :name => 'Feature request' | |
|
120 | } | |
|
121 | } | |
|
122 | end | |
|
88 | 123 | end |
|
89 | 124 | |
|
90 | 125 | context ".json" do |
General Comments 0
You need to be logged in to leave comments.
Login now