@@ -350,6 +350,37 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base | |||||
350 | end |
|
350 | end | |
351 | end |
|
351 | end | |
352 |
|
352 | |||
|
353 | test "GET /issues/:id.xml should contains visible spent_hours only" do | |||
|
354 | user = User.find_by_login('jsmith') | |||
|
355 | Role.find(1).update(:time_entries_visibility => 'own') | |||
|
356 | parent = Issue.find(3) | |||
|
357 | child = Issue.generate!(:parent_issue_id => parent.id) | |||
|
358 | TimeEntry.generate!(:user => user, :hours => 5.5, :issue_id => parent.id) | |||
|
359 | TimeEntry.generate!(:user => user, :hours => 2, :issue_id => child.id) | |||
|
360 | TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id) | |||
|
361 | get '/issues/3.xml', {} , credentials(user.login) | |||
|
362 | ||||
|
363 | assert_equal 'application/xml', response.content_type | |||
|
364 | assert_select 'issue' do | |||
|
365 | assert_select 'spent_hours', '5.5' | |||
|
366 | end | |||
|
367 | end | |||
|
368 | ||||
|
369 | test "GET /issues/:id.json should contains visible spent_hours only" do | |||
|
370 | user = User.find_by_login('jsmith') | |||
|
371 | Role.find(1).update(:time_entries_visibility => 'own') | |||
|
372 | parent = Issue.find(3) | |||
|
373 | child = Issue.generate!(:parent_issue_id => parent.id) | |||
|
374 | TimeEntry.generate!(:user => user, :hours => 5.5, :issue_id => parent.id) | |||
|
375 | TimeEntry.generate!(:user => user, :hours => 2, :issue_id => child.id) | |||
|
376 | TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id) | |||
|
377 | get '/issues/3.json', {} , credentials(user.login) | |||
|
378 | ||||
|
379 | assert_equal 'application/json', response.content_type | |||
|
380 | json = ActiveSupport::JSON.decode(response.body) | |||
|
381 | assert_equal 5.5, json['issue']['spent_hours'] | |||
|
382 | end | |||
|
383 | ||||
353 | test "POST /issues.xml should create an issue with the attributes" do |
|
384 | test "POST /issues.xml should create an issue with the attributes" do | |
354 |
|
385 | |||
355 | payload = <<-XML |
|
386 | payload = <<-XML |
General Comments 0
You need to be logged in to leave comments.
Login now