@@ -1,149 +1,158 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2014 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class Redmine::ApiTest::ApiRoutingTest < Redmine::ApiTest::Routing |
|
21 | 21 | |
|
22 | 22 | def test_attachments |
|
23 | 23 | should_route 'GET /attachments/1' => 'attachments#show', :id => '1' |
|
24 | 24 | should_route 'POST /uploads' => 'attachments#upload' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | 27 | def test_custom_fields |
|
28 | 28 | should_route 'GET /custom_fields' => 'custom_fields#index' |
|
29 | 29 | end |
|
30 | 30 | |
|
31 | 31 | def test_enumerations |
|
32 | 32 | should_route 'GET /enumerations/issue_priorities' => 'enumerations#index', :type => 'issue_priorities' |
|
33 | 33 | end |
|
34 | 34 | |
|
35 | 35 | def test_groups |
|
36 | 36 | should_route 'GET /groups' => 'groups#index' |
|
37 | 37 | should_route 'POST /groups' => 'groups#create' |
|
38 | 38 | |
|
39 | 39 | should_route 'GET /groups/1' => 'groups#show', :id => '1' |
|
40 | 40 | should_route 'PUT /groups/1' => 'groups#update', :id => '1' |
|
41 | 41 | should_route 'DELETE /groups/1' => 'groups#destroy', :id => '1' |
|
42 | 42 | end |
|
43 | 43 | |
|
44 | 44 | def test_group_users |
|
45 | 45 | should_route 'POST /groups/567/users' => 'groups#add_users', :id => '567' |
|
46 | 46 | should_route 'DELETE /groups/567/users/12' => 'groups#remove_user', :id => '567', :user_id => '12' |
|
47 | 47 | end |
|
48 | 48 | |
|
49 | 49 | def test_issue_categories |
|
50 | 50 | should_route 'GET /projects/foo/issue_categories' => 'issue_categories#index', :project_id => 'foo' |
|
51 | 51 | should_route 'POST /projects/foo/issue_categories' => 'issue_categories#create', :project_id => 'foo' |
|
52 | 52 | |
|
53 | 53 | should_route 'GET /issue_categories/1' => 'issue_categories#show', :id => '1' |
|
54 | 54 | should_route 'PUT /issue_categories/1' => 'issue_categories#update', :id => '1' |
|
55 | 55 | should_route 'DELETE /issue_categories/1' => 'issue_categories#destroy', :id => '1' |
|
56 | 56 | end |
|
57 | 57 | |
|
58 | 58 | def test_issue_relations |
|
59 | 59 | should_route 'GET /issues/1/relations' => 'issue_relations#index', :issue_id => '1' |
|
60 | 60 | should_route 'POST /issues/1/relations' => 'issue_relations#create', :issue_id => '1' |
|
61 | 61 | |
|
62 | 62 | should_route 'GET /relations/23' => 'issue_relations#show', :id => '23' |
|
63 | 63 | should_route 'DELETE /relations/23' => 'issue_relations#destroy', :id => '23' |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | def test_issue_statuses |
|
67 | 67 | should_route 'GET /issue_statuses' => 'issue_statuses#index' |
|
68 | 68 | end |
|
69 | 69 | |
|
70 | 70 | def test_issues |
|
71 | 71 | should_route 'GET /issues' => 'issues#index' |
|
72 | 72 | should_route 'POST /issues' => 'issues#create' |
|
73 | 73 | |
|
74 | 74 | should_route 'GET /issues/64' => 'issues#show', :id => '64' |
|
75 | 75 | should_route 'PUT /issues/64' => 'issues#update', :id => '64' |
|
76 | 76 | should_route 'DELETE /issues/64' => 'issues#destroy', :id => '64' |
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | def test_memberships |
|
80 | 80 | should_route 'GET /projects/5234/memberships' => 'members#index', :project_id => '5234' |
|
81 | 81 | should_route 'POST /projects/5234/memberships' => 'members#create', :project_id => '5234' |
|
82 | 82 | |
|
83 | 83 | should_route 'GET /memberships/5234' => 'members#show', :id => '5234' |
|
84 | 84 | should_route 'PUT /memberships/5234' => 'members#update', :id => '5234' |
|
85 | 85 | should_route 'DELETE /memberships/5234' => 'members#destroy', :id => '5234' |
|
86 | 86 | end |
|
87 | 87 | |
|
88 | 88 | def test_news |
|
89 | 89 | should_route 'GET /news' => 'news#index' |
|
90 | 90 | should_route 'GET /projects/567/news' => 'news#index', :project_id => '567' |
|
91 | 91 | end |
|
92 | 92 | |
|
93 | 93 | def test_projects |
|
94 | 94 | should_route 'GET /projects' => 'projects#index' |
|
95 | 95 | should_route 'POST /projects' => 'projects#create' |
|
96 | 96 | |
|
97 | 97 | should_route 'GET /projects/1' => 'projects#show', :id => '1' |
|
98 | 98 | should_route 'PUT /projects/1' => 'projects#update', :id => '1' |
|
99 | 99 | should_route 'DELETE /projects/1' => 'projects#destroy', :id => '1' |
|
100 | 100 | end |
|
101 | 101 | |
|
102 | 102 | def test_queries |
|
103 | 103 | should_route 'GET /queries' => 'queries#index' |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | def test_roles |
|
107 | 107 | should_route 'GET /roles' => 'roles#index' |
|
108 | 108 | should_route 'GET /roles/2' => 'roles#show', :id => '2' |
|
109 | 109 | end |
|
110 | 110 | |
|
111 | def test_time_entries | |
|
112 | should_route 'GET /time_entries' => 'timelog#index' | |
|
113 | should_route 'POST /time_entries' => 'timelog#create' | |
|
114 | ||
|
115 | should_route 'GET /time_entries/1' => 'timelog#show', :id => '1' | |
|
116 | should_route 'PUT /time_entries/1' => 'timelog#update', :id => '1' | |
|
117 | should_route 'DELETE /time_entries/1' => 'timelog#destroy', :id => '1' | |
|
118 | end | |
|
119 | ||
|
111 | 120 | def test_trackers |
|
112 | 121 | should_route 'GET /trackers' => 'trackers#index' |
|
113 | 122 | end |
|
114 | 123 | |
|
115 | 124 | def test_users |
|
116 | 125 | should_route 'GET /users' => 'users#index' |
|
117 | 126 | should_route 'POST /users' => 'users#create' |
|
118 | 127 | |
|
119 | 128 | should_route 'GET /users/44' => 'users#show', :id => '44' |
|
120 | 129 | should_route 'GET /users/current' => 'users#show', :id => 'current' |
|
121 | 130 | should_route 'PUT /users/44' => 'users#update', :id => '44' |
|
122 | 131 | should_route 'DELETE /users/44' => 'users#destroy', :id => '44' |
|
123 | 132 | end |
|
124 | 133 | |
|
125 | 134 | def test_versions |
|
126 | 135 | should_route 'GET /projects/foo/versions' => 'versions#index', :project_id => 'foo' |
|
127 | 136 | should_route 'POST /projects/foo/versions' => 'versions#create', :project_id => 'foo' |
|
128 | 137 | |
|
129 | 138 | should_route 'GET /versions/1' => 'versions#show', :id => '1' |
|
130 | 139 | should_route 'PUT /versions/1' => 'versions#update', :id => '1' |
|
131 | 140 | should_route 'DELETE /versions/1' => 'versions#destroy', :id => '1' |
|
132 | 141 | end |
|
133 | 142 | |
|
134 | 143 | def test_watchers |
|
135 | 144 | should_route 'POST /issues/12/watchers' => 'watchers#create', :object_type => 'issue', :object_id => '12' |
|
136 | 145 | should_route 'DELETE /issues/12/watchers/3' => 'watchers#destroy', :object_type => 'issue', :object_id => '12', :user_id => '3' |
|
137 | 146 | end |
|
138 | 147 | |
|
139 | 148 | def test_wiki |
|
140 | 149 | should_route 'GET /projects/567/wiki/index' => 'wiki#index', :project_id => '567' |
|
141 | 150 | |
|
142 | 151 | should_route 'GET /projects/567/wiki/my_page' => 'wiki#show', :project_id => '567', :id => 'my_page' |
|
143 | 152 | should_route 'GET /projects/567/wiki/my_page' => 'wiki#show', :project_id => '567', :id => 'my_page' |
|
144 | 153 | should_route 'GET /projects/1/wiki/my_page/2' => 'wiki#show', :project_id => '1', :id => 'my_page', :version => '2' |
|
145 | 154 | |
|
146 | 155 | should_route 'PUT /projects/567/wiki/my_page' => 'wiki#update', :project_id => '567', :id => 'my_page' |
|
147 | 156 | should_route 'DELETE /projects/567/wiki/my_page' => 'wiki#destroy', :project_id => '567', :id => 'my_page' |
|
148 | 157 | end |
|
149 | 158 | end |
General Comments 0
You need to be logged in to leave comments.
Login now