mirror of
https://github.com/redmine/redmine.git
synced 2025-11-08 14:26:04 +01:00
Merged r16293 (#24875).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16307 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -392,6 +392,23 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
||||
end
|
||||
end
|
||||
|
||||
test "GET /issues/:id.xml should contains visible spent_hours only" do
|
||||
user = User.find_by_login('jsmith')
|
||||
Role.find(1).update(:time_entries_visibility => 'own')
|
||||
parent = Issue.find(3)
|
||||
child = Issue.generate!(:parent_issue_id => parent.id)
|
||||
TimeEntry.generate!(:user => user, :hours => 5.5, :issue_id => parent.id)
|
||||
TimeEntry.generate!(:user => user, :hours => 2, :issue_id => child.id)
|
||||
TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id)
|
||||
get '/issues/3.xml', {} , credentials(user.login)
|
||||
|
||||
assert_equal 'application/xml', response.content_type
|
||||
assert_select 'issue' do
|
||||
assert_select 'spent_hours', '5.5'
|
||||
assert_select 'total_spent_hours', '7.5'
|
||||
end
|
||||
end
|
||||
|
||||
test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
|
||||
parent = Issue.find(3)
|
||||
parent.update_columns :estimated_hours => 2.0
|
||||
@@ -425,6 +442,22 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
||||
assert_nil json['issue']['total_spent_hours']
|
||||
end
|
||||
|
||||
test "GET /issues/:id.json should contains visible spent_hours only" do
|
||||
user = User.find_by_login('jsmith')
|
||||
Role.find(1).update(:time_entries_visibility => 'own')
|
||||
parent = Issue.find(3)
|
||||
child = Issue.generate!(:parent_issue_id => parent.id)
|
||||
TimeEntry.generate!(:user => user, :hours => 5.5, :issue_id => parent.id)
|
||||
TimeEntry.generate!(:user => user, :hours => 2, :issue_id => child.id)
|
||||
TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id)
|
||||
get '/issues/3.json', {} , credentials(user.login)
|
||||
|
||||
assert_equal 'application/json', response.content_type
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_equal 5.5, json['issue']['spent_hours']
|
||||
assert_equal 7.5, json['issue']['total_spent_hours']
|
||||
end
|
||||
|
||||
test "POST /issues.xml should create an issue with the attributes" do
|
||||
|
||||
payload = <<-XML
|
||||
|
||||
Reference in New Issue
Block a user