remove trailing white-spaces from test/integration/api_test/issues_test.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6945 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
54ae8de42b
commit
d51cc908fe
|
@ -5,12 +5,12 @@
|
|||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
@ -51,10 +51,10 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
# 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")
|
||||
|
||||
|
||||
should "contain metadata" do
|
||||
get '/issues.xml'
|
||||
|
||||
|
||||
assert_tag :tag => 'issues',
|
||||
:attributes => {
|
||||
:type => 'array',
|
||||
|
@ -63,11 +63,11 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
:offset => 0
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
context "with offset and limit" do
|
||||
should "use the params" do
|
||||
get '/issues.xml?offset=2&limit=3'
|
||||
|
||||
|
||||
assert_equal 3, assigns(:limit)
|
||||
assert_equal 2, assigns(:offset)
|
||||
assert_tag :tag => 'issues', :children => {:count => 3, :only => {:tag => 'issue'}}
|
||||
|
@ -77,7 +77,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
context "with nometa param" do
|
||||
should "not contain metadata" do
|
||||
get '/issues.xml?nometa=1'
|
||||
|
||||
|
||||
assert_tag :tag => 'issues',
|
||||
:attributes => {
|
||||
:type => 'array',
|
||||
|
@ -91,7 +91,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
context "with nometa header" do
|
||||
should "not contain metadata" do
|
||||
get '/issues.xml', {}, {'X-Redmine-Nometa' => '1'}
|
||||
|
||||
|
||||
assert_tag :tag => 'issues',
|
||||
:attributes => {
|
||||
:type => 'array',
|
||||
|
@ -101,11 +101,11 @@ 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',
|
||||
|
@ -120,11 +120,11 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
:children => {:count => 0}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "with invalid query params" do
|
||||
should "return errors" do
|
||||
get '/issues.xml', {:f => ['start_date'], :op => {:start_date => '='}}
|
||||
|
||||
|
||||
assert_response :unprocessable_entity
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_tag 'errors', :child => {:tag => 'error', :content => "Start date can't be blank"}
|
||||
|
@ -140,7 +140,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
should "show only issues with the status_id" do
|
||||
get '/issues.xml?status_id=5'
|
||||
assert_tag :tag => 'issues',
|
||||
:children => { :count => Issue.visible.count(:conditions => {:status_id => 5}),
|
||||
:children => { :count => Issue.visible.count(:conditions => {:status_id => 5}),
|
||||
:only => { :tag => 'issue' } }
|
||||
end
|
||||
end
|
||||
|
@ -165,13 +165,13 @@ 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 journals" do
|
||||
context ".xml" do
|
||||
should "display journals" do
|
||||
get '/issues/1.xml?include=journals'
|
||||
|
||||
|
||||
assert_tag :tag => 'issue',
|
||||
:child => {
|
||||
:tag => 'journals',
|
||||
|
@ -200,13 +200,13 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "with custom fields" do
|
||||
context ".xml" do
|
||||
should "display custom fields" do
|
||||
get '/issues/3.xml'
|
||||
|
||||
assert_tag :tag => 'issue',
|
||||
|
||||
assert_tag :tag => 'issue',
|
||||
:child => {
|
||||
:tag => 'custom_fields',
|
||||
:attributes => { :type => 'array' },
|
||||
|
@ -219,19 +219,19 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assert_nothing_raised do
|
||||
Hash.from_xml(response.body).to_xml
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "with attachments" do
|
||||
context ".xml" do
|
||||
should "display attachments" do
|
||||
get '/issues/3.xml?include=attachments'
|
||||
|
||||
|
||||
assert_tag :tag => 'issue',
|
||||
:child => {
|
||||
:tag => 'attachments',
|
||||
|
@ -251,19 +251,19 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
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?include=children'
|
||||
|
||||
assert_tag :tag => 'issue',
|
||||
|
||||
assert_tag :tag => 'issue',
|
||||
:child => {
|
||||
:tag => 'children',
|
||||
:children => {:count => 2},
|
||||
|
@ -285,11 +285,11 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
context ".json" do
|
||||
should "display children" do
|
||||
get '/issues/1.json?include=children'
|
||||
|
||||
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_equal([
|
||||
{
|
||||
|
@ -315,19 +315,19 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
assert_difference('Issue.count') do
|
||||
post '/issues.xml', {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, :authorization => credentials('jsmith')
|
||||
end
|
||||
|
||||
|
||||
issue = Issue.first(:order => 'id DESC')
|
||||
assert_equal 1, issue.project_id
|
||||
assert_equal 2, issue.tracker_id
|
||||
assert_equal 3, issue.status_id
|
||||
assert_equal 'API test', issue.subject
|
||||
|
||||
|
||||
assert_response :created
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_tag 'issue', :child => {:tag => 'id', :content => issue.id.to_s}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "POST /issues.xml with failure" do
|
||||
should "have an errors tag" do
|
||||
assert_no_difference('Issue.count') do
|
||||
|
@ -348,16 +348,16 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
assert_difference('Issue.count') do
|
||||
post '/issues.json', {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, :authorization => credentials('jsmith')
|
||||
end
|
||||
|
||||
|
||||
issue = Issue.first(:order => 'id DESC')
|
||||
assert_equal 1, issue.project_id
|
||||
assert_equal 2, issue.tracker_id
|
||||
assert_equal 3, issue.status_id
|
||||
assert_equal 'API test', issue.subject
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
context "POST /issues.json with failure" do
|
||||
should "have an errors element" do
|
||||
assert_no_difference('Issue.count') do
|
||||
|
@ -375,7 +375,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
@parameters = {:issue => {:subject => 'API update', :notes => 'A new note'}}
|
||||
@headers = { :authorization => credentials('jsmith') }
|
||||
end
|
||||
|
||||
|
||||
should_allow_api_authentication(:put,
|
||||
'/issues/6.xml',
|
||||
{:issue => {:subject => 'API update', :notes => 'A new note'}},
|
||||
|
@ -395,37 +395,37 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
|
||||
should "add the note to the journal" do
|
||||
put '/issues/6.xml', @parameters, @headers
|
||||
|
||||
|
||||
journal = Journal.last
|
||||
assert_equal "A new note", journal.notes
|
||||
end
|
||||
|
||||
should "update the issue" do
|
||||
put '/issues/6.xml', @parameters, @headers
|
||||
|
||||
|
||||
issue = Issue.find(6)
|
||||
assert_equal "API update", issue.subject
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
context "PUT /issues/3.xml with custom fields" do
|
||||
setup do
|
||||
@parameters = {:issue => {:custom_fields => [{'id' => '1', 'value' => 'PostgreSQL' }, {'id' => '2', 'value' => '150'}]}}
|
||||
@headers = { :authorization => credentials('jsmith') }
|
||||
end
|
||||
|
||||
|
||||
should "update custom fields" do
|
||||
assert_no_difference('Issue.count') do
|
||||
put '/issues/3.xml', @parameters, @headers
|
||||
end
|
||||
|
||||
|
||||
issue = Issue.find(3)
|
||||
assert_equal '150', issue.custom_value_for(2).value
|
||||
assert_equal 'PostgreSQL', issue.custom_value_for(1).value
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "PUT /issues/6.xml with failed update" do
|
||||
setup do
|
||||
@parameters = {:issue => {:subject => ''}}
|
||||
|
@ -456,7 +456,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
@parameters = {:issue => {:subject => 'API update', :notes => 'A new note'}}
|
||||
@headers = { :authorization => credentials('jsmith') }
|
||||
end
|
||||
|
||||
|
||||
should_allow_api_authentication(:put,
|
||||
'/issues/6.json',
|
||||
{:issue => {:subject => 'API update', :notes => 'A new note'}},
|
||||
|
@ -476,20 +476,20 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
|
||||
should "add the note to the journal" do
|
||||
put '/issues/6.json', @parameters, @headers
|
||||
|
||||
|
||||
journal = Journal.last
|
||||
assert_equal "A new note", journal.notes
|
||||
end
|
||||
|
||||
should "update the issue" do
|
||||
put '/issues/6.json', @parameters, @headers
|
||||
|
||||
|
||||
issue = Issue.find(6)
|
||||
assert_equal "API update", issue.subject
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
context "PUT /issues/6.json with failed update" do
|
||||
setup do
|
||||
@parameters = {:issue => {:subject => ''}}
|
||||
|
@ -526,7 +526,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
assert_difference('Issue.count',-1) do
|
||||
delete '/issues/6.xml', {}, :authorization => credentials('jsmith')
|
||||
end
|
||||
|
||||
|
||||
assert_nil Issue.find_by_id(6)
|
||||
end
|
||||
end
|
||||
|
@ -541,7 +541,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
|||
assert_difference('Issue.count',-1) do
|
||||
delete '/issues/6.json', {}, :authorization => credentials('jsmith')
|
||||
end
|
||||
|
||||
|
||||
assert_nil Issue.find_by_id(6)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue