mirror of
https://github.com/redmine/redmine.git
synced 2025-11-01 02:46:13 +01:00
Isolates all API routing tests to a specific test case.
git-svn-id: http://svn.redmine.org/redmine/trunk@13604 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -10,3 +10,4 @@ deprecated_task :migrate_from_trac, "redmine:migrate_from_trac"
|
||||
deprecated_task "db:migrate_plugins", "redmine:plugins:migrate"
|
||||
deprecated_task "db:migrate:plugin", "redmine:plugins:migrate"
|
||||
deprecated_task :generate_session_store, :generate_secret_token
|
||||
deprecated_task "test:rdm_routing", "test:routing"
|
||||
|
||||
@@ -98,10 +98,10 @@ namespace :test do
|
||||
Rake::Task['test:scm:functionals'].comment = "Run the scm functional tests"
|
||||
end
|
||||
|
||||
Rake::TestTask.new(:rdm_routing) do |t|
|
||||
Rake::TestTask.new(:routing) do |t|
|
||||
t.libs << "test"
|
||||
t.verbose = true
|
||||
t.test_files = FileList['test/integration/routing/*_test.rb']
|
||||
t.test_files = FileList['test/integration/routing/*_test.rb'] + FileList['test/integration/api_test/*_routing_test.rb']
|
||||
end
|
||||
Rake::Task['test:rdm_routing'].comment = "Run the routing tests"
|
||||
|
||||
|
||||
162
test/integration/api_test/api_routing_test.rb
Normal file
162
test/integration/api_test/api_routing_test.rb
Normal file
@@ -0,0 +1,162 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2014 Jean-Philippe Lang
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
class Redmine::ApiTest::ApiRoutingTest < Redmine::ApiTest::Routing
|
||||
|
||||
def test_attachments
|
||||
should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
|
||||
should_route 'POST /uploads' => 'attachments#upload'
|
||||
end
|
||||
|
||||
def test_custom_fields
|
||||
should_route 'GET /custom_fields' => 'custom_fields#index'
|
||||
end
|
||||
|
||||
def test_enumerations
|
||||
should_route 'GET /enumerations/issue_priorities' => 'enumerations#index', :type => 'issue_priorities'
|
||||
end
|
||||
|
||||
def test_groups
|
||||
should_route 'GET /groups' => 'groups#index'
|
||||
should_route 'POST /groups' => 'groups#create'
|
||||
|
||||
should_route 'GET /groups/1' => 'groups#show', :id => '1'
|
||||
should_route 'PUT /groups/1' => 'groups#update', :id => '1'
|
||||
should_route 'DELETE /groups/1' => 'groups#destroy', :id => '1'
|
||||
end
|
||||
|
||||
def test_group_users
|
||||
should_route 'POST /groups/567/users' => 'groups#add_users', :id => '567'
|
||||
should_route 'DELETE /groups/567/users/12' => 'groups#remove_user', :id => '567', :user_id => '12'
|
||||
end
|
||||
|
||||
def test_issue_categories
|
||||
should_route 'GET /projects/foo/issue_categories' => 'issue_categories#index', :project_id => 'foo'
|
||||
should_route 'POST /projects/foo/issue_categories' => 'issue_categories#create', :project_id => 'foo'
|
||||
|
||||
should_route 'GET /issue_categories/1' => 'issue_categories#show', :id => '1'
|
||||
should_route 'PUT /issue_categories/1' => 'issue_categories#update', :id => '1'
|
||||
should_route 'DELETE /issue_categories/1' => 'issue_categories#destroy', :id => '1'
|
||||
end
|
||||
|
||||
def test_issue_relations
|
||||
should_route 'GET /issues/1/relations' => 'issue_relations#index', :issue_id => '1'
|
||||
should_route 'POST /issues/1/relations' => 'issue_relations#create', :issue_id => '1'
|
||||
|
||||
should_route 'GET /relations/23' => 'issue_relations#show', :id => '23'
|
||||
should_route 'DELETE /relations/23' => 'issue_relations#destroy', :id => '23'
|
||||
end
|
||||
|
||||
def test_issue_statuses
|
||||
should_route 'GET /issue_statuses' => 'issue_statuses#index'
|
||||
should_route 'POST /issue_statuses' => 'issue_statuses#create' # NOT IMPLEMENTED
|
||||
should_route 'GET /issue_statuses/new' => 'issue_statuses#new' # NOT IMPLEMENTED
|
||||
|
||||
should_route 'PUT /issue_statuses/1' => 'issue_statuses#update', :id => '1' # NOT IMPLEMENTED
|
||||
should_route 'DELETE /issue_statuses/1' => 'issue_statuses#destroy', :id => '1' # NOT IMPLEMENTED
|
||||
should_route 'POST /issue_statuses/update_issue_done_ratio' => 'issue_statuses#update_issue_done_ratio' # NOT IMPLEMENTED
|
||||
end
|
||||
|
||||
def test_issues
|
||||
should_route 'GET /issues' => 'issues#index'
|
||||
should_route 'POST /issues' => 'issues#create'
|
||||
|
||||
should_route 'GET /projects/23/issues' => 'issues#index', :project_id => '23'
|
||||
|
||||
should_route 'GET /issues/64' => 'issues#show', :id => '64'
|
||||
should_route 'PUT /issues/64' => 'issues#update', :id => '64'
|
||||
should_route 'DELETE /issues/64' => 'issues#destroy', :id => '64'
|
||||
end
|
||||
|
||||
def test_memberships
|
||||
should_route 'GET /projects/5234/memberships' => 'members#index', :project_id => '5234'
|
||||
should_route 'POST /projects/5234/memberships' => 'members#create', :project_id => '5234'
|
||||
|
||||
should_route 'GET /memberships/5234' => 'members#show', :id => '5234'
|
||||
should_route 'PUT /memberships/5234' => 'members#update', :id => '5234'
|
||||
should_route 'DELETE /memberships/5234' => 'members#destroy', :id => '5234'
|
||||
end
|
||||
|
||||
def test_news
|
||||
should_route 'GET /news' => 'news#index'
|
||||
should_route 'GET /projects/567/news' => 'news#index', :project_id => '567'
|
||||
end
|
||||
|
||||
def test_projects
|
||||
should_route 'GET /projects' => 'projects#index'
|
||||
should_route 'POST /projects' => 'projects#create'
|
||||
|
||||
should_route 'GET /projects/1' => 'projects#show', :id => '1'
|
||||
should_route 'PUT /projects/1' => 'projects#update', :id => '1'
|
||||
should_route 'DELETE /projects/1' => 'projects#destroy', :id => '1'
|
||||
end
|
||||
|
||||
def test_queries
|
||||
should_route 'GET /queries' => 'queries#index'
|
||||
end
|
||||
|
||||
def test_roles
|
||||
should_route 'GET /roles' => 'roles#index'
|
||||
should_route 'GET /roles/2' => 'roles#show', :id => '2'
|
||||
end
|
||||
|
||||
def test_trackers
|
||||
should_route 'GET /trackers' => 'trackers#index'
|
||||
should_route 'POST /trackers' => 'trackers#create' # NOT IMPLEMENTED
|
||||
should_route 'GET /trackers/new' => 'trackers#new' # NOT IMPLEMENTED
|
||||
|
||||
should_route 'PUT /trackers/1' => 'trackers#update', :id => '1' # NOT IMPLEMENTED
|
||||
should_route 'DELETE /trackers/1' => 'trackers#destroy', :id => '1' # NOT IMPLEMENTED
|
||||
end
|
||||
|
||||
def test_users
|
||||
should_route 'GET /users' => 'users#index'
|
||||
should_route 'POST /users' => 'users#create'
|
||||
|
||||
should_route 'GET /users/44' => 'users#show', :id => '44'
|
||||
should_route 'GET /users/current' => 'users#show', :id => 'current'
|
||||
should_route 'PUT /users/44' => 'users#update', :id => '44'
|
||||
should_route 'DELETE /users/44' => 'users#destroy', :id => '44'
|
||||
end
|
||||
|
||||
def test_versions
|
||||
should_route 'GET /projects/foo/versions' => 'versions#index', :project_id => 'foo'
|
||||
should_route 'POST /projects/foo/versions' => 'versions#create', :project_id => 'foo'
|
||||
|
||||
should_route 'GET /versions/1' => 'versions#show', :id => '1'
|
||||
should_route 'PUT /versions/1' => 'versions#update', :id => '1'
|
||||
should_route 'DELETE /versions/1' => 'versions#destroy', :id => '1'
|
||||
end
|
||||
|
||||
def test_watchers
|
||||
should_route 'POST /issues/12/watchers' => 'watchers#create', :object_type => 'issue', :object_id => '12'
|
||||
should_route 'DELETE /issues/12/watchers/3' => 'watchers#destroy', :object_type => 'issue', :object_id => '12', :user_id => '3'
|
||||
end
|
||||
|
||||
def test_wiki
|
||||
should_route 'GET /projects/567/wiki/index' => 'wiki#index', :project_id => '567'
|
||||
|
||||
should_route 'GET /projects/567/wiki/my_page' => 'wiki#show', :project_id => '567', :id => 'my_page'
|
||||
should_route 'GET /projects/567/wiki/my_page' => 'wiki#show', :project_id => '567', :id => 'my_page'
|
||||
should_route 'GET /projects/1/wiki/my_page/2' => 'wiki#show', :project_id => '1', :id => 'my_page', :version => '2'
|
||||
|
||||
should_route 'PUT /projects/567/wiki/my_page' => 'wiki#update', :project_id => '567', :id => 'my_page'
|
||||
should_route 'DELETE /projects/567/wiki/my_page' => 'wiki#destroy', :project_id => '567', :id => 'my_page'
|
||||
end
|
||||
end
|
||||
@@ -23,14 +23,6 @@ class RoutingAttachmentsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/attachments/1" },
|
||||
{ :controller => 'attachments', :action => 'show', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/attachments/1.xml" },
|
||||
{ :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/attachments/1.json" },
|
||||
{ :controller => 'attachments', :action => 'show', :id => '1', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/attachments/1/filename.ext" },
|
||||
{ :controller => 'attachments', :action => 'show', :id => '1',
|
||||
@@ -57,13 +49,5 @@ class RoutingAttachmentsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'delete', :path => "/attachments/1" },
|
||||
{ :controller => 'attachments', :action => 'destroy', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => '/uploads.xml' },
|
||||
{ :controller => 'attachments', :action => 'upload', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => '/uploads.json' },
|
||||
{ :controller => 'attachments', :action => 'upload', :format => 'json' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,11 +44,4 @@ class RoutingCustomFieldsTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'custom_fields', :action => 'destroy', :id => '2' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_custom_fields_api
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/custom_fields.xml" },
|
||||
{ :controller => 'custom_fields', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,9 +43,5 @@ class RoutingEnumerationsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'delete', :path => "/enumerations/2" },
|
||||
{ :controller => 'enumerations', :action => 'destroy', :id => '2' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/enumerations/issue_priorities.xml" },
|
||||
{ :controller => 'enumerations', :action => 'index', :type => 'issue_priorities', :format => 'xml' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,18 +23,10 @@ class RoutingGroupsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/groups" },
|
||||
{ :controller => 'groups', :action => 'index' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/groups.xml" },
|
||||
{ :controller => 'groups', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/groups" },
|
||||
{ :controller => 'groups', :action => 'create' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/groups.xml" },
|
||||
{ :controller => 'groups', :action => 'create', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/groups/new" },
|
||||
{ :controller => 'groups', :action => 'new' }
|
||||
@@ -55,26 +47,14 @@ class RoutingGroupsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/groups/1" },
|
||||
{ :controller => 'groups', :action => 'show', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/groups/1.xml" },
|
||||
{ :controller => 'groups', :action => 'show', :id => '1', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/groups/1" },
|
||||
{ :controller => 'groups', :action => 'update', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/groups/1.xml" },
|
||||
{ :controller => 'groups', :action => 'update', :id => '1', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/groups/1" },
|
||||
{ :controller => 'groups', :action => 'destroy', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/groups/1.xml" },
|
||||
{ :controller => 'groups', :action => 'destroy', :id => '1', :format => 'xml' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_groups
|
||||
@@ -86,17 +66,9 @@ class RoutingGroupsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'post', :path => "/groups/567/users" },
|
||||
{ :controller => 'groups', :action => 'add_users', :id => '567' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/groups/567/users.xml" },
|
||||
{ :controller => 'groups', :action => 'add_users', :id => '567', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/groups/567/users/12" },
|
||||
{ :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/groups/567/users/12.xml" },
|
||||
{ :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12', :format => 'xml' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,16 +24,6 @@ class RoutingIssueCategoriesTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'issue_categories', :action => 'index',
|
||||
:project_id => 'foo' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/foo/issue_categories.xml" },
|
||||
{ :controller => 'issue_categories', :action => 'index',
|
||||
:project_id => 'foo', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/foo/issue_categories.json" },
|
||||
{ :controller => 'issue_categories', :action => 'index',
|
||||
:project_id => 'foo', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/foo/issue_categories/new" },
|
||||
{ :controller => 'issue_categories', :action => 'new',
|
||||
@@ -44,16 +34,6 @@ class RoutingIssueCategoriesTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'issue_categories', :action => 'create',
|
||||
:project_id => 'foo' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/foo/issue_categories.xml" },
|
||||
{ :controller => 'issue_categories', :action => 'create',
|
||||
:project_id => 'foo', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/foo/issue_categories.json" },
|
||||
{ :controller => 'issue_categories', :action => 'create',
|
||||
:project_id => 'foo', :format => 'json' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_issue_categories
|
||||
@@ -61,16 +41,6 @@ class RoutingIssueCategoriesTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/issue_categories/1" },
|
||||
{ :controller => 'issue_categories', :action => 'show', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_categories/1.xml" },
|
||||
{ :controller => 'issue_categories', :action => 'show', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_categories/1.json" },
|
||||
{ :controller => 'issue_categories', :action => 'show', :id => '1',
|
||||
:format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_categories/1/edit" },
|
||||
{ :controller => 'issue_categories', :action => 'edit', :id => '1' }
|
||||
@@ -79,29 +49,9 @@ class RoutingIssueCategoriesTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'put', :path => "/issue_categories/1" },
|
||||
{ :controller => 'issue_categories', :action => 'update', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/issue_categories/1.xml" },
|
||||
{ :controller => 'issue_categories', :action => 'update', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/issue_categories/1.json" },
|
||||
{ :controller => 'issue_categories', :action => 'update', :id => '1',
|
||||
:format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issue_categories/1" },
|
||||
{ :controller => 'issue_categories', :action => 'destroy', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issue_categories/1.xml" },
|
||||
{ :controller => 'issue_categories', :action => 'destroy', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issue_categories/1.json" },
|
||||
{ :controller => 'issue_categories', :action => 'destroy', :id => '1',
|
||||
:format => 'json' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,58 +24,18 @@ class RoutingIssueRelationsTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'issue_relations', :action => 'index',
|
||||
:issue_id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues/1/relations.xml" },
|
||||
{ :controller => 'issue_relations', :action => 'index',
|
||||
:issue_id => '1', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues/1/relations.json" },
|
||||
{ :controller => 'issue_relations', :action => 'index',
|
||||
:issue_id => '1', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issues/1/relations" },
|
||||
{ :controller => 'issue_relations', :action => 'create',
|
||||
:issue_id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issues/1/relations.xml" },
|
||||
{ :controller => 'issue_relations', :action => 'create',
|
||||
:issue_id => '1', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issues/1/relations.json" },
|
||||
{ :controller => 'issue_relations', :action => 'create',
|
||||
:issue_id => '1', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/relations/23" },
|
||||
{ :controller => 'issue_relations', :action => 'show', :id => '23' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/relations/23.xml" },
|
||||
{ :controller => 'issue_relations', :action => 'show', :id => '23',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/relations/23.json" },
|
||||
{ :controller => 'issue_relations', :action => 'show', :id => '23',
|
||||
:format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/relations/23" },
|
||||
{ :controller => 'issue_relations', :action => 'destroy', :id => '23' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/relations/23.xml" },
|
||||
{ :controller => 'issue_relations', :action => 'destroy', :id => '23',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/relations/23.json" },
|
||||
{ :controller => 'issue_relations', :action => 'destroy', :id => '23',
|
||||
:format => 'json' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,26 +23,14 @@ class RoutingIssueStatusesTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/issue_statuses" },
|
||||
{ :controller => 'issue_statuses', :action => 'index' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_statuses.xml" },
|
||||
{ :controller => 'issue_statuses', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issue_statuses" },
|
||||
{ :controller => 'issue_statuses', :action => 'create' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issue_statuses.xml" },
|
||||
{ :controller => 'issue_statuses', :action => 'create', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_statuses/new" },
|
||||
{ :controller => 'issue_statuses', :action => 'new' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_statuses/new.xml" },
|
||||
{ :controller => 'issue_statuses', :action => 'new', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issue_statuses/1/edit" },
|
||||
{ :controller => 'issue_statuses', :action => 'edit', :id => '1' }
|
||||
@@ -52,29 +40,14 @@ class RoutingIssueStatusesTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'issue_statuses', :action => 'update',
|
||||
:id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/issue_statuses/1.xml" },
|
||||
{ :controller => 'issue_statuses', :action => 'update',
|
||||
:format => 'xml', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issue_statuses/1" },
|
||||
{ :controller => 'issue_statuses', :action => 'destroy',
|
||||
:id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issue_statuses/1.xml" },
|
||||
{ :controller => 'issue_statuses', :action => 'destroy',
|
||||
:format => 'xml', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issue_statuses/update_issue_done_ratio" },
|
||||
{ :controller => 'issue_statuses', :action => 'update_issue_done_ratio' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issue_statuses/update_issue_done_ratio.xml" },
|
||||
{ :controller => 'issue_statuses', :action => 'update_issue_done_ratio',
|
||||
:format => 'xml' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
class RoutingIssuesTest < ActionDispatch::IntegrationTest
|
||||
def test_issues_rest_actions
|
||||
def test_issues
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues" },
|
||||
{ :controller => 'issues', :action => 'index' }
|
||||
@@ -31,10 +31,6 @@ class RoutingIssuesTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/issues.atom" },
|
||||
{ :controller => 'issues', :action => 'index', :format => 'atom' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues.xml" },
|
||||
{ :controller => 'issues', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues/64" },
|
||||
{ :controller => 'issues', :action => 'show', :id => '64' }
|
||||
@@ -49,32 +45,21 @@ class RoutingIssuesTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'issues', :action => 'show', :id => '64',
|
||||
:format => 'atom' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues/64.xml" },
|
||||
{ :controller => 'issues', :action => 'show', :id => '64',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issues.xml" },
|
||||
{ :controller => 'issues', :action => 'create', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/issues/64/edit" },
|
||||
{ :controller => 'issues', :action => 'edit', :id => '64' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/issues/1.xml" },
|
||||
{ :controller => 'issues', :action => 'update', :id => '1',
|
||||
:format => 'xml' }
|
||||
{ :method => 'put', :path => "/issues/1" },
|
||||
{ :controller => 'issues', :action => 'update', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issues/1.xml" },
|
||||
{ :controller => 'issues', :action => 'destroy', :id => '1',
|
||||
:format => 'xml' }
|
||||
{ :method => 'delete', :path => "/issues/1" },
|
||||
{ :controller => 'issues', :action => 'destroy', :id => '1' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_issues_rest_actions_scoped_under_project
|
||||
def test_issues_scoped_under_project
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/23/issues" },
|
||||
{ :controller => 'issues', :action => 'index', :project_id => '23' }
|
||||
@@ -89,11 +74,6 @@ class RoutingIssuesTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'issues', :action => 'index', :project_id => '23',
|
||||
:format => 'atom' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/23/issues.xml" },
|
||||
{ :controller => 'issues', :action => 'index', :project_id => '23',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/23/issues" },
|
||||
{ :controller => 'issues', :action => 'create', :project_id => '23' }
|
||||
|
||||
@@ -19,22 +19,10 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
class RoutingMembersTest < ActionDispatch::IntegrationTest
|
||||
def test_members
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/5234/memberships.xml" },
|
||||
{ :controller => 'members', :action => 'index', :project_id => '5234', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/memberships/5234.xml" },
|
||||
{ :controller => 'members', :action => 'show', :id => '5234', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/5234/memberships" },
|
||||
{ :controller => 'members', :action => 'create', :project_id => '5234' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/5234/memberships.xml" },
|
||||
{ :controller => 'members', :action => 'create', :project_id => '5234', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/5234/memberships/new" },
|
||||
{ :controller => 'members', :action => 'new', :project_id => '5234' }
|
||||
@@ -43,18 +31,10 @@ class RoutingMembersTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'put', :path => "/memberships/5234" },
|
||||
{ :controller => 'members', :action => 'update', :id => '5234' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/memberships/5234.xml" },
|
||||
{ :controller => 'members', :action => 'update', :id => '5234', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/memberships/5234" },
|
||||
{ :controller => 'members', :action => 'destroy', :id => '5234' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/memberships/5234.xml" },
|
||||
{ :controller => 'members', :action => 'destroy', :id => '5234', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/5234/memberships/autocomplete" },
|
||||
{ :controller => 'members', :action => 'autocomplete', :project_id => '5234' }
|
||||
|
||||
@@ -27,14 +27,6 @@ class RoutingNewsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/news.atom" },
|
||||
{ :controller => 'news', :action => 'index', :format => 'atom' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/news.xml" },
|
||||
{ :controller => 'news', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/news.json" },
|
||||
{ :controller => 'news', :action => 'index', :format => 'json' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_news
|
||||
@@ -70,16 +62,6 @@ class RoutingNewsTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'news', :action => 'index', :format => 'atom',
|
||||
:project_id => '567' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/news.xml" },
|
||||
{ :controller => 'news', :action => 'index', :format => 'xml',
|
||||
:project_id => '567' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/news.json" },
|
||||
{ :controller => 'news', :action => 'index', :format => 'json',
|
||||
:project_id => '567' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/news/new" },
|
||||
{ :controller => 'news', :action => 'new', :project_id => '567' }
|
||||
|
||||
@@ -27,10 +27,6 @@ class RoutingProjectsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/projects.atom" },
|
||||
{ :controller => 'projects', :action => 'index', :format => 'atom' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects.xml" },
|
||||
{ :controller => 'projects', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/new" },
|
||||
{ :controller => 'projects', :action => 'new' }
|
||||
@@ -39,11 +35,6 @@ class RoutingProjectsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/projects/test" },
|
||||
{ :controller => 'projects', :action => 'show', :id => 'test' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/1.xml" },
|
||||
{ :controller => 'projects', :action => 'show', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/4223/settings" },
|
||||
{ :controller => 'projects', :action => 'settings', :id => '4223' }
|
||||
@@ -57,10 +48,6 @@ class RoutingProjectsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'post', :path => "/projects" },
|
||||
{ :controller => 'projects', :action => 'create' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects.xml" },
|
||||
{ :controller => 'projects', :action => 'create', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/64/archive" },
|
||||
{ :controller => 'projects', :action => 'archive', :id => '64' }
|
||||
@@ -81,19 +68,9 @@ class RoutingProjectsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'put', :path => "/projects/4223" },
|
||||
{ :controller => 'projects', :action => 'update', :id => '4223' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/projects/1.xml" },
|
||||
{ :controller => 'projects', :action => 'update', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/projects/64" },
|
||||
{ :controller => 'projects', :action => 'destroy', :id => '64' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/projects/1.xml" },
|
||||
{ :controller => 'projects', :action => 'destroy', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,14 +19,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
class RoutingQueriesTest < ActionDispatch::IntegrationTest
|
||||
def test_queries
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/queries.xml" },
|
||||
{ :controller => 'queries', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/queries.json" },
|
||||
{ :controller => 'queries', :action => 'index', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/queries/new" },
|
||||
{ :controller => 'queries', :action => 'new' }
|
||||
|
||||
@@ -23,14 +23,6 @@ class RoutingRolesTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/roles" },
|
||||
{ :controller => 'roles', :action => 'index' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/roles.xml" },
|
||||
{ :controller => 'roles', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/roles/2.xml" },
|
||||
{ :controller => 'roles', :action => 'show', :id => '2', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/roles/new" },
|
||||
{ :controller => 'roles', :action => 'new' }
|
||||
|
||||
@@ -23,26 +23,14 @@ class RoutingTrackersTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/trackers" },
|
||||
{ :controller => 'trackers', :action => 'index' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/trackers.xml" },
|
||||
{ :controller => 'trackers', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/trackers" },
|
||||
{ :controller => 'trackers', :action => 'create' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/trackers.xml" },
|
||||
{ :controller => 'trackers', :action => 'create', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/trackers/new" },
|
||||
{ :controller => 'trackers', :action => 'new' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/trackers/new.xml" },
|
||||
{ :controller => 'trackers', :action => 'new', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/trackers/1/edit" },
|
||||
{ :controller => 'trackers', :action => 'edit', :id => '1' }
|
||||
@@ -52,21 +40,11 @@ class RoutingTrackersTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'trackers', :action => 'update',
|
||||
:id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/trackers/1.xml" },
|
||||
{ :controller => 'trackers', :action => 'update',
|
||||
:format => 'xml', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/trackers/1" },
|
||||
{ :controller => 'trackers', :action => 'destroy',
|
||||
:id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/trackers/1.xml" },
|
||||
{ :controller => 'trackers', :action => 'destroy',
|
||||
:format => 'xml', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/trackers/fields" },
|
||||
{ :controller => 'trackers', :action => 'fields' }
|
||||
|
||||
@@ -23,28 +23,14 @@ class RoutingUsersTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/users" },
|
||||
{ :controller => 'users', :action => 'index' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/users.xml" },
|
||||
{ :controller => 'users', :action => 'index', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/users/44" },
|
||||
{ :controller => 'users', :action => 'show', :id => '44' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/users/44.xml" },
|
||||
{ :controller => 'users', :action => 'show', :id => '44',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/users/current" },
|
||||
{ :controller => 'users', :action => 'show', :id => 'current' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/users/current.xml" },
|
||||
{ :controller => 'users', :action => 'show', :id => 'current',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/users/new" },
|
||||
{ :controller => 'users', :action => 'new' }
|
||||
@@ -57,27 +43,13 @@ class RoutingUsersTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'post', :path => "/users" },
|
||||
{ :controller => 'users', :action => 'create' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/users.xml" },
|
||||
{ :controller => 'users', :action => 'create', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/users/444" },
|
||||
{ :controller => 'users', :action => 'update', :id => '444' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/users/444.xml" },
|
||||
{ :controller => 'users', :action => 'update', :id => '444',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/users/44" },
|
||||
{ :controller => 'users', :action => 'destroy', :id => '44' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/users/44.xml" },
|
||||
{ :controller => 'users', :action => 'destroy', :id => '44',
|
||||
:format => 'xml' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,16 +32,6 @@ class RoutingVersionsTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'versions', :action => 'close_completed',
|
||||
:project_id => 'foo' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/foo/versions.xml" },
|
||||
{ :controller => 'versions', :action => 'index',
|
||||
:project_id => 'foo', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/foo/versions.json" },
|
||||
{ :controller => 'versions', :action => 'index',
|
||||
:project_id => 'foo', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/foo/versions/new" },
|
||||
{ :controller => 'versions', :action => 'new',
|
||||
@@ -52,16 +42,6 @@ class RoutingVersionsTest < ActionDispatch::IntegrationTest
|
||||
{ :controller => 'versions', :action => 'create',
|
||||
:project_id => 'foo' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/foo/versions.xml" },
|
||||
{ :controller => 'versions', :action => 'create',
|
||||
:project_id => 'foo', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/projects/foo/versions.json" },
|
||||
{ :controller => 'versions', :action => 'create',
|
||||
:project_id => 'foo', :format => 'json' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_versions
|
||||
@@ -69,16 +49,6 @@ class RoutingVersionsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'get', :path => "/versions/1" },
|
||||
{ :controller => 'versions', :action => 'show', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/versions/1.xml" },
|
||||
{ :controller => 'versions', :action => 'show', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/versions/1.json" },
|
||||
{ :controller => 'versions', :action => 'show', :id => '1',
|
||||
:format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/versions/1/edit" },
|
||||
{ :controller => 'versions', :action => 'edit', :id => '1' }
|
||||
@@ -87,30 +57,10 @@ class RoutingVersionsTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'put', :path => "/versions/1" },
|
||||
{ :controller => 'versions', :action => 'update', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/versions/1.xml" },
|
||||
{ :controller => 'versions', :action => 'update', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/versions/1.json" },
|
||||
{ :controller => 'versions', :action => 'update', :id => '1',
|
||||
:format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/versions/1" },
|
||||
{ :controller => 'versions', :action => 'destroy', :id => '1' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/versions/1.xml" },
|
||||
{ :controller => 'versions', :action => 'destroy', :id => '1',
|
||||
:format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/versions/1.json" },
|
||||
{ :controller => 'versions', :action => 'destroy', :id => '1',
|
||||
:format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/versions/1/status_by" },
|
||||
{ :controller => 'versions', :action => 'status_by', :id => '1' }
|
||||
|
||||
@@ -47,15 +47,5 @@ class RoutingWatchersTest < ActionDispatch::IntegrationTest
|
||||
{ :method => 'delete', :path => "/watchers/watch" },
|
||||
{ :controller => 'watchers', :action => 'unwatch' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'post', :path => "/issues/12/watchers.xml" },
|
||||
{ :controller => 'watchers', :action => 'create',
|
||||
:object_type => 'issue', :object_id => '12', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/issues/12/watchers/3.xml" },
|
||||
{ :controller => 'watchers', :action => 'destroy',
|
||||
:object_type => 'issue', :object_id => '12', :user_id => '3', :format => 'xml'}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -132,55 +132,4 @@ class RoutingWikiTest < ActionDispatch::IntegrationTest
|
||||
:id => 'ladida', :version => '3' }
|
||||
)
|
||||
end
|
||||
|
||||
def test_api
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/wiki/my_page.xml" },
|
||||
{ :controller => 'wiki', :action => 'show', :project_id => '567',
|
||||
:id => 'my_page', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/wiki/my_page.json" },
|
||||
{ :controller => 'wiki', :action => 'show', :project_id => '567',
|
||||
:id => 'my_page', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.xml" },
|
||||
{ :controller => 'wiki', :action => 'show', :project_id => '1',
|
||||
:id => 'CookBook_documentation', :version => '2', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.json" },
|
||||
{ :controller => 'wiki', :action => 'show', :project_id => '1',
|
||||
:id => 'CookBook_documentation', :version => '2', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/wiki/index.xml" },
|
||||
{ :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'get', :path => "/projects/567/wiki/index.json" },
|
||||
{ :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/projects/567/wiki/my_page.xml" },
|
||||
{ :controller => 'wiki', :action => 'update', :project_id => '567',
|
||||
:id => 'my_page', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'put', :path => "/projects/567/wiki/my_page.json" },
|
||||
{ :controller => 'wiki', :action => 'update', :project_id => '567',
|
||||
:id => 'my_page', :format => 'json' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/projects/567/wiki/my_page.xml" },
|
||||
{ :controller => 'wiki', :action => 'destroy', :project_id => '567',
|
||||
:id => 'my_page', :format => 'xml' }
|
||||
)
|
||||
assert_routing(
|
||||
{ :method => 'delete', :path => "/projects/567/wiki/my_page.json" },
|
||||
{ :controller => 'wiki', :action => 'destroy', :project_id => '567',
|
||||
:id => 'my_page', :format => 'json' }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -238,7 +238,29 @@ class ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
module Redmine
|
||||
class RoutingTest < ActionDispatch::IntegrationTest
|
||||
def should_route(arg)
|
||||
arg = arg.dup
|
||||
request = arg.keys.detect {|key| key.is_a?(String)}
|
||||
raise ArgumentError unless request
|
||||
options = arg.slice!(request)
|
||||
|
||||
raise ArgumentError unless request =~ /\A(GET|POST|PUT|PATCH|DELETE)\s+(.+)\z/
|
||||
method, path = $1.downcase.to_sym, $2
|
||||
|
||||
raise ArgumentError unless arg.values.first =~ /\A(.+)#(.+)\z/
|
||||
controller, action = $1, $2
|
||||
|
||||
assert_routing(
|
||||
{:method => method, :path => path},
|
||||
options.merge(:controller => controller, :action => action)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
module ApiTest
|
||||
API_FORMATS = %w(json xml).freeze
|
||||
|
||||
# Base class for API tests
|
||||
class Base < ActionDispatch::IntegrationTest
|
||||
# Test that a request allows the three types of API authentication
|
||||
@@ -491,6 +513,20 @@ module Redmine
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Routing < Redmine::RoutingTest
|
||||
def should_route(arg)
|
||||
arg = arg.dup
|
||||
request = arg.keys.detect {|key| key.is_a?(String)}
|
||||
raise ArgumentError unless request
|
||||
options = arg.slice!(request)
|
||||
|
||||
API_FORMATS.each do |format|
|
||||
format_request = request.sub /$/, ".#{format}"
|
||||
super options.merge(format_request => arg[request], :format => format)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user