##// END OF EJS Templates
Merged r16293 (#24875)....
Jean-Philippe Lang -
r15925:cca51a8c51c8
parent child
Show More
@@ -392,6 +392,23 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
392 end
392 end
393 end
393 end
394
394
395 test "GET /issues/:id.xml should contains visible spent_hours only" do
396 user = User.find_by_login('jsmith')
397 Role.find(1).update(:time_entries_visibility => 'own')
398 parent = Issue.find(3)
399 child = Issue.generate!(:parent_issue_id => parent.id)
400 TimeEntry.generate!(:user => user, :hours => 5.5, :issue_id => parent.id)
401 TimeEntry.generate!(:user => user, :hours => 2, :issue_id => child.id)
402 TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id)
403 get '/issues/3.xml', {} , credentials(user.login)
404
405 assert_equal 'application/xml', response.content_type
406 assert_select 'issue' do
407 assert_select 'spent_hours', '5.5'
408 assert_select 'total_spent_hours', '7.5'
409 end
410 end
411
395 test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
412 test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
396 parent = Issue.find(3)
413 parent = Issue.find(3)
397 parent.update_columns :estimated_hours => 2.0
414 parent.update_columns :estimated_hours => 2.0
@@ -425,6 +442,22 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
425 assert_nil json['issue']['total_spent_hours']
442 assert_nil json['issue']['total_spent_hours']
426 end
443 end
427
444
445 test "GET /issues/:id.json should contains visible spent_hours only" do
446 user = User.find_by_login('jsmith')
447 Role.find(1).update(:time_entries_visibility => 'own')
448 parent = Issue.find(3)
449 child = Issue.generate!(:parent_issue_id => parent.id)
450 TimeEntry.generate!(:user => user, :hours => 5.5, :issue_id => parent.id)
451 TimeEntry.generate!(:user => user, :hours => 2, :issue_id => child.id)
452 TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id)
453 get '/issues/3.json', {} , credentials(user.login)
454
455 assert_equal 'application/json', response.content_type
456 json = ActiveSupport::JSON.decode(response.body)
457 assert_equal 5.5, json['issue']['spent_hours']
458 assert_equal 7.5, json['issue']['total_spent_hours']
459 end
460
428 test "POST /issues.xml should create an issue with the attributes" do
461 test "POST /issues.xml should create an issue with the attributes" do
429
462
430 payload = <<-XML
463 payload = <<-XML
General Comments 0
You need to be logged in to leave comments. Login now