##// END OF EJS Templates
remove trailing white-spaces from test/integration/api_test/issues_test.rb....
Toshi MARUYAMA -
r6825:d51cc908fe66
parent child
Show More
@@ -5,12 +5,12
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 #
8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 #
13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -51,10 +51,10 class ApiTest::IssuesTest < ActionController::IntegrationTest
51 51 # Use a private project to make sure auth is really working and not just
52 52 # only showing public issues.
53 53 should_allow_api_authentication(:get, "/projects/private-child/issues.xml")
54
54
55 55 should "contain metadata" do
56 56 get '/issues.xml'
57
57
58 58 assert_tag :tag => 'issues',
59 59 :attributes => {
60 60 :type => 'array',
@@ -63,11 +63,11 class ApiTest::IssuesTest < ActionController::IntegrationTest
63 63 :offset => 0
64 64 }
65 65 end
66
66
67 67 context "with offset and limit" do
68 68 should "use the params" do
69 69 get '/issues.xml?offset=2&limit=3'
70
70
71 71 assert_equal 3, assigns(:limit)
72 72 assert_equal 2, assigns(:offset)
73 73 assert_tag :tag => 'issues', :children => {:count => 3, :only => {:tag => 'issue'}}
@@ -77,7 +77,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
77 77 context "with nometa param" do
78 78 should "not contain metadata" do
79 79 get '/issues.xml?nometa=1'
80
80
81 81 assert_tag :tag => 'issues',
82 82 :attributes => {
83 83 :type => 'array',
@@ -91,7 +91,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
91 91 context "with nometa header" do
92 92 should "not contain metadata" do
93 93 get '/issues.xml', {}, {'X-Redmine-Nometa' => '1'}
94
94
95 95 assert_tag :tag => 'issues',
96 96 :attributes => {
97 97 :type => 'array',
@@ -101,11 +101,11 class ApiTest::IssuesTest < ActionController::IntegrationTest
101 101 }
102 102 end
103 103 end
104
104
105 105 context "with relations" do
106 106 should "display relations" do
107 107 get '/issues.xml?include=relations'
108
108
109 109 assert_response :success
110 110 assert_equal 'application/xml', @response.content_type
111 111 assert_tag 'relations',
@@ -120,11 +120,11 class ApiTest::IssuesTest < ActionController::IntegrationTest
120 120 :children => {:count => 0}
121 121 end
122 122 end
123
123
124 124 context "with invalid query params" do
125 125 should "return errors" do
126 126 get '/issues.xml', {:f => ['start_date'], :op => {:start_date => '='}}
127
127
128 128 assert_response :unprocessable_entity
129 129 assert_equal 'application/xml', @response.content_type
130 130 assert_tag 'errors', :child => {:tag => 'error', :content => "Start date can't be blank"}
@@ -140,7 +140,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
140 140 should "show only issues with the status_id" do
141 141 get '/issues.xml?status_id=5'
142 142 assert_tag :tag => 'issues',
143 :children => { :count => Issue.visible.count(:conditions => {:status_id => 5}),
143 :children => { :count => Issue.visible.count(:conditions => {:status_id => 5}),
144 144 :only => { :tag => 'issue' } }
145 145 end
146 146 end
@@ -165,13 +165,13 class ApiTest::IssuesTest < ActionController::IntegrationTest
165 165 context "/issues/6.json" do
166 166 should_allow_api_authentication(:get, "/issues/6.json")
167 167 end
168
168
169 169 context "GET /issues/:id" do
170 170 context "with journals" do
171 171 context ".xml" do
172 172 should "display journals" do
173 173 get '/issues/1.xml?include=journals'
174
174
175 175 assert_tag :tag => 'issue',
176 176 :child => {
177 177 :tag => 'journals',
@@ -200,13 +200,13 class ApiTest::IssuesTest < ActionController::IntegrationTest
200 200 end
201 201 end
202 202 end
203
203
204 204 context "with custom fields" do
205 205 context ".xml" do
206 206 should "display custom fields" do
207 207 get '/issues/3.xml'
208
209 assert_tag :tag => 'issue',
208
209 assert_tag :tag => 'issue',
210 210 :child => {
211 211 :tag => 'custom_fields',
212 212 :attributes => { :type => 'array' },
@@ -219,19 +219,19 class ApiTest::IssuesTest < ActionController::IntegrationTest
219 219 }
220 220 }
221 221 }
222
222
223 223 assert_nothing_raised do
224 224 Hash.from_xml(response.body).to_xml
225 225 end
226 226 end
227 227 end
228 228 end
229
229
230 230 context "with attachments" do
231 231 context ".xml" do
232 232 should "display attachments" do
233 233 get '/issues/3.xml?include=attachments'
234
234
235 235 assert_tag :tag => 'issue',
236 236 :child => {
237 237 :tag => 'attachments',
@@ -251,19 +251,19 class ApiTest::IssuesTest < ActionController::IntegrationTest
251 251 end
252 252 end
253 253 end
254
254
255 255 context "with subtasks" do
256 256 setup do
257 257 @c1 = Issue.generate!(:status_id => 1, :subject => "child c1", :tracker_id => 1, :project_id => 1, :parent_issue_id => 1)
258 258 @c2 = Issue.generate!(:status_id => 1, :subject => "child c2", :tracker_id => 1, :project_id => 1, :parent_issue_id => 1)
259 259 @c3 = Issue.generate!(:status_id => 1, :subject => "child c3", :tracker_id => 1, :project_id => 1, :parent_issue_id => @c1.id)
260 260 end
261
261
262 262 context ".xml" do
263 263 should "display children" do
264 264 get '/issues/1.xml?include=children'
265
266 assert_tag :tag => 'issue',
265
266 assert_tag :tag => 'issue',
267 267 :child => {
268 268 :tag => 'children',
269 269 :children => {:count => 2},
@@ -285,11 +285,11 class ApiTest::IssuesTest < ActionController::IntegrationTest
285 285 }
286 286 }
287 287 end
288
288
289 289 context ".json" do
290 290 should "display children" do
291 291 get '/issues/1.json?include=children'
292
292
293 293 json = ActiveSupport::JSON.decode(response.body)
294 294 assert_equal([
295 295 {
@@ -315,19 +315,19 class ApiTest::IssuesTest < ActionController::IntegrationTest
315 315 assert_difference('Issue.count') do
316 316 post '/issues.xml', {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, :authorization => credentials('jsmith')
317 317 end
318
318
319 319 issue = Issue.first(:order => 'id DESC')
320 320 assert_equal 1, issue.project_id
321 321 assert_equal 2, issue.tracker_id
322 322 assert_equal 3, issue.status_id
323 323 assert_equal 'API test', issue.subject
324
324
325 325 assert_response :created
326 326 assert_equal 'application/xml', @response.content_type
327 327 assert_tag 'issue', :child => {:tag => 'id', :content => issue.id.to_s}
328 328 end
329 329 end
330
330
331 331 context "POST /issues.xml with failure" do
332 332 should "have an errors tag" do
333 333 assert_no_difference('Issue.count') do
@@ -348,16 +348,16 class ApiTest::IssuesTest < ActionController::IntegrationTest
348 348 assert_difference('Issue.count') do
349 349 post '/issues.json', {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, :authorization => credentials('jsmith')
350 350 end
351
351
352 352 issue = Issue.first(:order => 'id DESC')
353 353 assert_equal 1, issue.project_id
354 354 assert_equal 2, issue.tracker_id
355 355 assert_equal 3, issue.status_id
356 356 assert_equal 'API test', issue.subject
357 357 end
358
358
359 359 end
360
360
361 361 context "POST /issues.json with failure" do
362 362 should "have an errors element" do
363 363 assert_no_difference('Issue.count') do
@@ -375,7 +375,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
375 375 @parameters = {:issue => {:subject => 'API update', :notes => 'A new note'}}
376 376 @headers = { :authorization => credentials('jsmith') }
377 377 end
378
378
379 379 should_allow_api_authentication(:put,
380 380 '/issues/6.xml',
381 381 {:issue => {:subject => 'API update', :notes => 'A new note'}},
@@ -395,37 +395,37 class ApiTest::IssuesTest < ActionController::IntegrationTest
395 395
396 396 should "add the note to the journal" do
397 397 put '/issues/6.xml', @parameters, @headers
398
398
399 399 journal = Journal.last
400 400 assert_equal "A new note", journal.notes
401 401 end
402 402
403 403 should "update the issue" do
404 404 put '/issues/6.xml', @parameters, @headers
405
405
406 406 issue = Issue.find(6)
407 407 assert_equal "API update", issue.subject
408 408 end
409
409
410 410 end
411
411
412 412 context "PUT /issues/3.xml with custom fields" do
413 413 setup do
414 414 @parameters = {:issue => {:custom_fields => [{'id' => '1', 'value' => 'PostgreSQL' }, {'id' => '2', 'value' => '150'}]}}
415 415 @headers = { :authorization => credentials('jsmith') }
416 416 end
417
417
418 418 should "update custom fields" do
419 419 assert_no_difference('Issue.count') do
420 420 put '/issues/3.xml', @parameters, @headers
421 421 end
422
422
423 423 issue = Issue.find(3)
424 424 assert_equal '150', issue.custom_value_for(2).value
425 425 assert_equal 'PostgreSQL', issue.custom_value_for(1).value
426 426 end
427 427 end
428
428
429 429 context "PUT /issues/6.xml with failed update" do
430 430 setup do
431 431 @parameters = {:issue => {:subject => ''}}
@@ -456,7 +456,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
456 456 @parameters = {:issue => {:subject => 'API update', :notes => 'A new note'}}
457 457 @headers = { :authorization => credentials('jsmith') }
458 458 end
459
459
460 460 should_allow_api_authentication(:put,
461 461 '/issues/6.json',
462 462 {:issue => {:subject => 'API update', :notes => 'A new note'}},
@@ -476,20 +476,20 class ApiTest::IssuesTest < ActionController::IntegrationTest
476 476
477 477 should "add the note to the journal" do
478 478 put '/issues/6.json', @parameters, @headers
479
479
480 480 journal = Journal.last
481 481 assert_equal "A new note", journal.notes
482 482 end
483 483
484 484 should "update the issue" do
485 485 put '/issues/6.json', @parameters, @headers
486
486
487 487 issue = Issue.find(6)
488 488 assert_equal "API update", issue.subject
489 489 end
490
490
491 491 end
492
492
493 493 context "PUT /issues/6.json with failed update" do
494 494 setup do
495 495 @parameters = {:issue => {:subject => ''}}
@@ -526,7 +526,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
526 526 assert_difference('Issue.count',-1) do
527 527 delete '/issues/6.xml', {}, :authorization => credentials('jsmith')
528 528 end
529
529
530 530 assert_nil Issue.find_by_id(6)
531 531 end
532 532 end
@@ -541,7 +541,7 class ApiTest::IssuesTest < ActionController::IntegrationTest
541 541 assert_difference('Issue.count',-1) do
542 542 delete '/issues/6.json', {}, :authorization => credentials('jsmith')
543 543 end
544
544
545 545 assert_nil Issue.find_by_id(6)
546 546 end
547 547 end
General Comments 0
You need to be logged in to leave comments. Login now