diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-04 13:02:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-04 13:02:14 +0000 |
commit | 915748204965bb7f9704b55554e30f091934138e (patch) | |
tree | 03a0e543b2b68bf885a0f5477ffd55b714ef072f /test/integration | |
parent | 88e593ee027b1fc1bdfa63b6ab76b0ae51ec6295 (diff) | |
download | redmine-915748204965bb7f9704b55554e30f091934138e.tar.gz redmine-915748204965bb7f9704b55554e30f091934138e.zip |
Adds subtasks to GET /issues/:id API (#5338).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4465 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api_test/issues_test.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index d7bc785c0..0ef9de8e2 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -89,6 +89,60 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest context "/issues/6.json" do should_allow_api_authentication(:get, "/issues/6.json") end + + context "GET /issues/:id" do + context "with subtasks" do + setup do + @c1 = Issue.generate!(:status_id => 1, :subject => "child c1", :tracker_id => 1, :project_id => 1, :parent_issue_id => 1) + @c2 = Issue.generate!(:status_id => 1, :subject => "child c2", :tracker_id => 1, :project_id => 1, :parent_issue_id => 1) + @c3 = Issue.generate!(:status_id => 1, :subject => "child c3", :tracker_id => 1, :project_id => 1, :parent_issue_id => @c1.id) + end + + context ".xml" do + should "display children" do + get '/issues/1.xml' + + assert_tag :tag => 'issue', + :child => { + :tag => 'children', + :children => {:count => 2}, + :child => { + :tag => 'issue', + :attributes => {:id => @c1.id.to_s}, + :child => { + :tag => 'subject', + :content => 'child c1', + :sibling => { + :tag => 'children', + :children => {:count => 1}, + :child => { + :tag => 'issue', + :attributes => {:id => @c3.id.to_s} + } + } + } + } + } + end + + context ".json" do + should "display children" do + get '/issues/1.json' + + json = ActiveSupport::JSON.decode(response.body) + assert_equal([ + { + 'id' => @c1.id, 'subject' => 'child c1', 'tracker' => {'id' => 1, 'name' => 'Bug'}, + 'children' => [{ 'id' => @c3.id, 'subject' => 'child c3', 'tracker' => {'id' => 1, 'name' => 'Bug'} }] + }, + { 'id' => @c2.id, 'subject' => 'child c2', 'tracker' => {'id' => 1, 'name' => 'Bug'} } + ], + json['issue']['children']) + end + end + end + end + end context "POST /issues.xml" do should_allow_api_authentication(:post, |