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