summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-30 17:54:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-30 17:54:08 +0000
commit1efe3eb3a1f43d0f101cd9baf3da7ed8de2caf96 (patch)
treec6db75d5ddb3a70a79deed8f640f22cc33fc4ec7
parent0f9966aadf86d90cc9cad6059ff0d03870c2b9c4 (diff)
downloadredmine-1efe3eb3a1f43d0f101cd9baf3da7ed8de2caf96.tar.gz
redmine-1efe3eb3a1f43d0f101cd9baf3da7ed8de2caf96.zip
Backported r16293 (#24875).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16309 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/integration/api_test/issues_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index 97483171f..837982ec8 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -350,6 +350,37 @@ 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'
+ end
+ 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']
+ end
+
test "POST /issues.xml should create an issue with the attributes" do
payload = <<-XML