20 |
20 |
class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
|
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, :issue_categories
|
|
23 |
:attachments, :custom_fields, :custom_values, :time_entries, :issue_categories, :documents
|
24 |
24 |
|
25 |
25 |
def setup
|
26 |
26 |
super
|
... | ... | |
73 |
73 |
assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]'
|
74 |
74 |
end
|
75 |
75 |
|
|
76 |
test "GET /projects.xml with include=documents should return documents" do
|
|
77 |
get '/projects.xml?include=documents'
|
|
78 |
assert_response :success
|
|
79 |
assert_equal 'application/xml', @response.content_type
|
|
80 |
|
|
81 |
assert_select 'documents[type=array]>document>id', :text => '1'
|
|
82 |
assert_select 'documents[type=array]>document>title', :text => 'Test document'
|
|
83 |
assert_select 'documents[type=array]>document>description', :text => 'Document description'
|
|
84 |
assert_select 'documents[type=array]>document>category[id="1"]'
|
|
85 |
assert_select 'documents[type=array]>document>category[name="Uncategorized"]'
|
|
86 |
assert_select 'documents[type=array]>document>url', :text => 'http://www.example.com/documents/1'
|
|
87 |
end
|
|
88 |
|
76 |
89 |
test "GET /projects/:id.xml should return the project" do
|
77 |
90 |
get '/projects/1.xml'
|
78 |
91 |
assert_response :success
|
... | ... | |
130 |
143 |
assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]'
|
131 |
144 |
end
|
132 |
145 |
|
|
146 |
test "GET /projects/:id.xml with include=documents should return documents" do
|
|
147 |
get '/projects/1.xml?include=documents'
|
|
148 |
assert_response :success
|
|
149 |
assert_equal 'application/xml', @response.content_type
|
|
150 |
|
|
151 |
assert_select 'documents[type=array]>document>id', :text => '1'
|
|
152 |
assert_select 'documents[type=array]>document>title', :text => 'Test document'
|
|
153 |
assert_select 'documents[type=array]>document>description', :text => 'Document description'
|
|
154 |
assert_select 'documents[type=array]>document>category[id="1"]'
|
|
155 |
assert_select 'documents[type=array]>document>category[name="Uncategorized"]'
|
|
156 |
assert_select 'documents[type=array]>document>url', :text => 'http://www.example.com/documents/1'
|
|
157 |
end
|
|
158 |
|
133 |
159 |
test "POST /projects.xml with valid parameters should create the project" do
|
134 |
160 |
with_settings :default_projects_modules => ['issue_tracking', 'repository'] do
|
135 |
161 |
assert_difference('Project.count') do
|