Ability to load relations on /issues API (#7366).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6313 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-07-24 15:34:41 +00:00
parent 49900051ea
commit 521eaa79cb
4 changed files with 40 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
Setting.rest_api_enabled = '1'
end
context "/index.xml" do
context "/issues" do
# Use a private project to make sure auth is really working and not just
# only showing public issues.
should_allow_api_authentication(:get, "/projects/private-child/issues.xml")
@@ -102,6 +102,25 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
end
end
context "with relations" do
should "display relations" do
get '/issues.xml?include=relations'
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_tag 'relations',
:parent => {:tag => 'issue', :child => {:tag => 'id', :content => '3'}},
:children => {:count => 1},
:child => {
:tag => 'relation',
:attributes => {:id => '2', :issue_id => '2', :issue_to_id => '3', :relation_type => 'relates'}
}
assert_tag 'relations',
:parent => {:tag => 'issue', :child => {:tag => 'id', :content => '1'}},
:children => {:count => 0}
end
end
context "with invalid query params" do
should "return errors" do
get '/issues.xml', {:f => ['start_date'], :op => {:start_date => '='}}