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