diff options
author | Go MAEDA <maeda@farend.jp> | 2021-06-27 07:18:58 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2021-06-27 07:18:58 +0000 |
commit | e2c08c7b36e4fd270aed6691d4d8d8e216b4a4c8 (patch) | |
tree | 41a0aec147a958e9bd53c51b87e5fc94f52c8d00 /test/integration | |
parent | 51755e4349fb46316aebbb192a03210ff09683f7 (diff) | |
download | redmine-e2c08c7b36e4fd270aed6691d4d8d8e216b4a4c8.tar.gz redmine-e2c08c7b36e4fd270aed6691d4d8d8e216b4a4c8.zip |
Add total estimated hours, spent hours, total spent hours for issues to issue list API (#34857).
Patch by Felix Schäfer and Takenori TAKAKI.
git-svn-id: http://svn.redmine.org/redmine/trunk@21051 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api_test/issues_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index 7a57d39fe..4435df6fd 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -141,6 +141,34 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base assert_select 'issues>issue>is_private', :text => 'false' end + def test_index_should_include_spent_hours + Issue.delete_all + parent = Issue.generate!(:estimated_hours => 2.0) + child = Issue.generate!(:parent_id => parent.id, :estimated_hours => 3.0) + TimeEntry.create!(:project => parent.project, :issue => parent, :user => parent.author, :spent_on => parent.author.today, + :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) + TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today, + :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) + + get '/issues.xml' + + assert_select 'issues issue', 2 + assert_select 'issues>issue>spent_hours', '2.5' + assert_select 'issues>issue>total_spent_hours', '5.0' + end + + def test_index_should_not_include_spent_hours + r = Role.anonymous + r.permissions.delete(:view_time_entries) + r.permissions_will_change! + r.save + + get '/issues.xml' + + assert_select 'issues>issue>spent_hours', false + assert_select 'issues>issue>total_spent_hours', false + end + def test_index_should_allow_timestamp_filtering Issue.delete_all Issue.generate!(:subject => '1').update_column(:updated_on, Time.parse("2014-01-02T10:25:00Z")) |