##// END OF EJS Templates
Don't require category or target version when they are not available (#20583)....
Don't require category or target version when they are not available (#20583). git-svn-id: http://svn.redmine.org/redmine/trunk@14733 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r13490:000124f44f53
r14351:68620da79ab5
Show More
issue_relations_test.rb
80 lines | 3.0 KiB | text/x-ruby | RubyLexer
/ test / integration / api_test / issue_relations_test.rb
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r13490 # Copyright (C) 2006-2015 Jean-Philippe Lang
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 #
# This program is free software; you can redistribute it and/or
# 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.
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811 #
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 # 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.
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811 #
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 # 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.
require File.expand_path('../../../test_helper', __FILE__)
Jean-Philippe Lang
Adds a subclass of ActionDispatch::IntegrationTest for API tests....
r11023 class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base
Toshi MARUYAMA
Rails3: replace "all" fixtures at test/integration/api_test/issue_relations_test.rb...
r7384 fixtures :projects, :trackers, :issue_statuses, :issues,
:enumerations, :users, :issue_categories,
:projects_trackers,
:roles,
:member_roles,
:members,
:enabled_modules,
:issue_relations
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056
Jean-Philippe Lang
Removed some shoulda context....
r11632 test "GET /issues/:issue_id/relations.xml should return issue relations" do
get '/issues/9/relations.xml', {}, credentials('jsmith')
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 assert_response :success
assert_equal 'application/xml', @response.content_type
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'relations[type=array] relation id', :text => '1'
Jean-Philippe Lang
Removed some shoulda context....
r11632 end
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 test "POST /issues/:issue_id/relations.xml should create the relation" do
assert_difference('IssueRelation.count') do
post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, credentials('jsmith')
end
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Toshi MARUYAMA
Rails4: replace deprecated Relation#first with finder options at ApiTest::IssueRelationsTest...
r12322 relation = IssueRelation.order('id DESC').first
Jean-Philippe Lang
Removed some shoulda context....
r11632 assert_equal 2, relation.issue_from_id
assert_equal 7, relation.issue_to_id
assert_equal 'relates', relation.relation_type
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 assert_response :created
assert_equal 'application/xml', @response.content_type
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'relation id', :text => relation.id.to_s
Jean-Philippe Lang
Removed some shoulda context....
r11632 end
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056
Jean-Philippe Lang
Removed some shoulda context....
r11632 test "POST /issues/:issue_id/relations.xml with failure should return errors" do
assert_no_difference('IssueRelation.count') do
post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'foo'}}, credentials('jsmith')
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 end
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 assert_response :unprocessable_entity
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'errors error', :text => /relation_type is not included in the list/
Jean-Philippe Lang
Removed some shoulda context....
r11632 end
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 test "GET /relations/:id.xml should return the relation" do
get '/relations/2.xml', {}, credentials('jsmith')
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 assert_response :success
assert_equal 'application/xml', @response.content_type
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'relation id', :text => '2'
Jean-Philippe Lang
Removed some shoulda context....
r11632 end
Toshi MARUYAMA
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
r6811
Jean-Philippe Lang
Removed some shoulda context....
r11632 test "DELETE /relations/:id.xml should delete the relation" do
assert_difference('IssueRelation.count', -1) do
delete '/relations/2.xml', {}, credentials('jsmith')
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 end
Jean-Philippe Lang
Removed some shoulda context....
r11632
assert_response :ok
assert_equal '', @response.body
assert_nil IssueRelation.find_by_id(2)
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 end
end