diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-11-16 10:54:33 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-11-16 10:54:33 +0000 |
commit | eae9c9ab2be43c64c830a03e414b51a08571c957 (patch) | |
tree | cbe6b20000d60ad854ad8f2e245cbdfeca4b4787 /test/integration/api_test/api_routing_test.rb | |
parent | cd6b2f2268d3e02ae652d3ad37f02170e3647a72 (diff) | |
download | redmine-eae9c9ab2be43c64c830a03e414b51a08571c957.tar.gz redmine-eae9c9ab2be43c64c830a03e414b51a08571c957.zip |
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
Diffstat (limited to 'test/integration/api_test/api_routing_test.rb')
-rw-r--r-- | test/integration/api_test/api_routing_test.rb | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/test/integration/api_test/api_routing_test.rb b/test/integration/api_test/api_routing_test.rb new file mode 100644 index 000000000..d36dc8377 --- /dev/null +++ b/test/integration/api_test/api_routing_test.rb @@ -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 |