@@ -1,44 +1,38 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::EnumerationsTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :enumerations |
|
22 | 22 | |
|
23 | 23 | def setup |
|
24 | 24 | Setting.rest_api_enabled = '1' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 |
|
|
|
28 | context "GET" do | |
|
29 | ||
|
30 | should "return priorities" do | |
|
27 | test "GET /enumerations/issue_priorities.xml should return priorities" do | |
|
31 | 28 |
|
|
32 | ||
|
33 | 29 |
|
|
34 | 30 |
|
|
35 | 31 |
|
|
36 | 32 |
|
|
37 | 33 |
|
|
38 | 34 |
|
|
39 | 35 |
|
|
40 | 36 |
|
|
41 | 37 |
|
|
42 | 38 |
|
|
43 | end | |
|
44 | end |
@@ -1,212 +1,170 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::GroupsTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :users, :groups_users |
|
22 | 22 | |
|
23 | 23 | def setup |
|
24 | 24 | Setting.rest_api_enabled = '1' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | context "GET /groups" do | |
|
28 | context ".xml" do | |
|
29 | should "require authentication" do | |
|
27 | test "GET /groups.xml should require authentication" do | |
|
30 | 28 |
|
|
31 | 29 |
|
|
32 | 30 |
|
|
33 | 31 | |
|
34 |
|
|
|
32 | test "GET /groups.xml should return groups" do | |
|
35 | 33 |
|
|
36 | 34 |
|
|
37 | 35 |
|
|
38 | 36 | |
|
39 | 37 |
|
|
40 | 38 |
|
|
41 | 39 |
|
|
42 | 40 |
|
|
43 | 41 |
|
|
44 | 42 |
|
|
45 | 43 |
|
|
46 | end | |
|
47 | 44 | |
|
48 | context ".json" do | |
|
49 | should "require authentication" do | |
|
45 | test "GET /groups.json should require authentication" do | |
|
50 | 46 |
|
|
51 | 47 |
|
|
52 | 48 |
|
|
53 | 49 | |
|
54 |
|
|
|
50 | test "GET /groups.json should return groups" do | |
|
55 | 51 |
|
|
56 | 52 |
|
|
57 | 53 |
|
|
58 | 54 | |
|
59 | 55 |
|
|
60 | 56 |
|
|
61 | 57 |
|
|
62 | 58 |
|
|
63 | 59 |
|
|
64 | 60 |
|
|
65 | 61 |
|
|
66 | end | |
|
67 | end | |
|
68 | 62 | |
|
69 | context "GET /groups/:id" do | |
|
70 | context ".xml" do | |
|
71 | should "return the group with its users" do | |
|
63 | test "GET /groups/:id.xml should return the group with its users" do | |
|
72 | 64 |
|
|
73 | 65 |
|
|
74 | 66 |
|
|
75 | 67 | |
|
76 | 68 |
|
|
77 | 69 |
|
|
78 | 70 |
|
|
79 | 71 |
|
|
80 | 72 |
|
|
81 | 73 | |
|
82 |
|
|
|
74 | test "GET /groups/:id.xml should include users if requested" do | |
|
83 | 75 |
|
|
84 | 76 |
|
|
85 | 77 |
|
|
86 | 78 | |
|
87 | 79 |
|
|
88 | 80 |
|
|
89 | 81 |
|
|
90 | 82 |
|
|
91 | 83 |
|
|
92 | 84 |
|
|
93 | 85 |
|
|
94 | 86 | |
|
95 |
|
|
|
87 | test "GET /groups/:id.xml include memberships if requested" do | |
|
96 | 88 |
|
|
97 | 89 |
|
|
98 | 90 |
|
|
99 | 91 | |
|
100 | 92 |
|
|
101 | 93 |
|
|
102 | 94 |
|
|
103 | 95 |
|
|
104 | end | |
|
105 | end | |
|
106 | 96 | |
|
107 | context "POST /groups" do | |
|
108 | context "with valid parameters" do | |
|
109 | context ".xml" do | |
|
110 | should "create groups" do | |
|
97 | test "POST /groups.xml with valid parameters should create the group" do | |
|
111 | 98 |
|
|
112 | 99 |
|
|
113 | 100 |
|
|
114 | 101 |
|
|
115 | 102 |
|
|
116 | 103 | |
|
117 | 104 |
|
|
118 | 105 |
|
|
119 | 106 |
|
|
120 | 107 | |
|
121 | 108 |
|
|
122 | 109 |
|
|
123 | 110 |
|
|
124 | 111 |
|
|
125 | end | |
|
126 | end | |
|
127 | 112 | |
|
128 |
|
|
|
129 | context ".xml" do | |
|
130 | should "return errors" do | |
|
113 | test "POST /groups.xml with invalid parameters should return errors" do | |
|
131 | 114 |
|
|
132 | 115 |
|
|
133 | 116 |
|
|
134 | 117 |
|
|
135 | 118 |
|
|
136 | 119 | |
|
137 | 120 |
|
|
138 | 121 |
|
|
139 | 122 |
|
|
140 | 123 |
|
|
141 | end | |
|
142 | end | |
|
143 | end | |
|
144 | 124 | |
|
145 | context "PUT /groups/:id" do | |
|
146 | context "with valid parameters" do | |
|
147 | context ".xml" do | |
|
148 | should "update the group" do | |
|
125 | test "PUT /groups/:id.xml with valid parameters should update the group" do | |
|
149 | 126 |
|
|
150 | 127 |
|
|
151 | 128 |
|
|
152 | 129 | |
|
153 | 130 |
|
|
154 | 131 |
|
|
155 | 132 |
|
|
156 | 133 |
|
|
157 | end | |
|
158 | end | |
|
159 | 134 | |
|
160 | context "with invalid parameters" do | |
|
161 | context ".xml" do | |
|
162 | should "return errors" do | |
|
135 | test "PUT /groups/:id.xml with invalid parameters should return errors" do | |
|
163 | 136 |
|
|
164 | 137 |
|
|
165 | 138 |
|
|
166 | 139 | |
|
167 | 140 |
|
|
168 | 141 |
|
|
169 | 142 |
|
|
170 | 143 |
|
|
171 | end | |
|
172 | end | |
|
173 | end | |
|
174 | 144 | |
|
175 |
|
|
|
176 | context ".xml" do | |
|
177 | should "delete the group" do | |
|
145 | test "DELETE /groups/:id.xml should delete the group" do | |
|
178 | 146 |
|
|
179 | 147 |
|
|
180 | 148 |
|
|
181 | 149 |
|
|
182 | 150 |
|
|
183 | 151 |
|
|
184 | end | |
|
185 | end | |
|
186 | 152 | |
|
187 |
|
|
|
188 | context ".xml" do | |
|
189 | should "add user to the group" do | |
|
153 | test "POST /groups/:id/users.xml should add user to the group" do | |
|
190 | 154 |
|
|
191 | 155 |
|
|
192 | 156 |
|
|
193 | 157 |
|
|
194 | 158 |
|
|
195 | 159 |
|
|
196 | 160 |
|
|
197 | end | |
|
198 | end | |
|
199 | 161 | |
|
200 |
|
|
|
201 | context ".xml" do | |
|
202 | should "remove user from the group" do | |
|
162 | test "DELETE /groups/:id/users/:user_id.xml should remove user from the group" do | |
|
203 | 163 |
|
|
204 | 164 |
|
|
205 | 165 |
|
|
206 | 166 |
|
|
207 | 167 |
|
|
208 | 168 |
|
|
209 | 169 |
|
|
210 | 170 |
|
|
211 | end | |
|
212 | end |
@@ -1,126 +1,110 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::IssueCategoriesTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :projects, :users, :issue_categories, :issues, |
|
22 | 22 | :roles, |
|
23 | 23 | :member_roles, |
|
24 | 24 | :members, |
|
25 | 25 | :enabled_modules |
|
26 | 26 | |
|
27 | 27 | def setup |
|
28 | 28 | Setting.rest_api_enabled = '1' |
|
29 | 29 | end |
|
30 | 30 | |
|
31 |
|
|
|
32 | should "return issue categories" do | |
|
31 | test "GET /projects/:project_id/issue_categories.xml should return the issue categories" do | |
|
33 | 32 |
|
|
34 | 33 |
|
|
35 | 34 |
|
|
36 | 35 |
|
|
37 | 36 |
|
|
38 | 37 |
|
|
39 | end | |
|
40 | 38 | |
|
41 |
|
|
|
42 | should "return requested issue category" do | |
|
39 | test "GET /issue_categories/:id.xml should return the issue category" do | |
|
43 | 40 |
|
|
44 | 41 |
|
|
45 | 42 |
|
|
46 | 43 |
|
|
47 | 44 |
|
|
48 | 45 |
|
|
49 | end | |
|
50 | 46 | |
|
51 |
|
|
|
52 | should "return create issue category" do | |
|
47 | test "POST /projects/:project_id/issue_categories.xml should return create issue category" do | |
|
53 | 48 |
|
|
54 | 49 |
|
|
55 | 50 |
|
|
56 | 51 |
|
|
57 | 52 |
|
|
58 | 53 | |
|
59 | 54 |
|
|
60 | 55 |
|
|
61 | 56 |
|
|
62 | 57 |
|
|
63 | 58 | |
|
64 | context "with invalid parameters" do | |
|
65 | should "return errors" do | |
|
59 | test "POST /projects/:project_id/issue_categories.xml with invalid parameters should return errors" do | |
|
66 | 60 |
|
|
67 | 61 |
|
|
68 | 62 |
|
|
69 | 63 |
|
|
70 | 64 |
|
|
71 | 65 | |
|
72 | 66 |
|
|
73 | 67 |
|
|
74 | end | |
|
75 | end | |
|
76 | 68 | |
|
77 | context "PUT /issue_categories/2.xml" do | |
|
78 | context "with valid parameters" do | |
|
79 | should "update issue category" do | |
|
69 | test "PUT /issue_categories/:id.xml with valid parameters should update the issue category" do | |
|
80 | 70 |
|
|
81 | 71 |
|
|
82 | 72 |
|
|
83 | 73 |
|
|
84 | 74 |
|
|
85 | 75 |
|
|
86 | 76 |
|
|
87 | end | |
|
88 | 77 | |
|
89 | context "with invalid parameters" do | |
|
90 | should "return errors" do | |
|
78 | test "PUT /issue_categories/:id.xml with invalid parameters should return errors" do | |
|
91 | 79 |
|
|
92 | 80 |
|
|
93 | 81 |
|
|
94 | 82 |
|
|
95 | 83 |
|
|
96 | 84 | |
|
97 | 85 |
|
|
98 | 86 |
|
|
99 | end | |
|
100 | end | |
|
101 | 87 | |
|
102 |
|
|
|
103 | should "destroy issue categories" do | |
|
88 | test "DELETE /issue_categories/:id.xml should destroy the issue category" do | |
|
104 | 89 |
|
|
105 | 90 |
|
|
106 | 91 |
|
|
107 | 92 |
|
|
108 | 93 |
|
|
109 | 94 |
|
|
110 | 95 |
|
|
111 | 96 | |
|
112 |
|
|
|
97 | test "DELETE /issue_categories/:id.xml should reassign issues with :reassign_to_id param" do | |
|
113 | 98 |
|
|
114 | 99 |
|
|
115 | 100 | |
|
116 | 101 |
|
|
117 | 102 |
|
|
118 | 103 |
|
|
119 | 104 |
|
|
120 | 105 |
|
|
121 | 106 |
|
|
122 | 107 |
|
|
123 | 108 |
|
|
124 | 109 |
|
|
125 | 110 |
|
|
126 | end |
@@ -1,106 +1,92 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::IssueRelationsTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :projects, :trackers, :issue_statuses, :issues, |
|
22 | 22 | :enumerations, :users, :issue_categories, |
|
23 | 23 | :projects_trackers, |
|
24 | 24 | :roles, |
|
25 | 25 | :member_roles, |
|
26 | 26 | :members, |
|
27 | 27 | :enabled_modules, |
|
28 | 28 | :issue_relations |
|
29 | 29 | |
|
30 | 30 | def setup |
|
31 | 31 | Setting.rest_api_enabled = '1' |
|
32 | 32 | end |
|
33 | 33 | |
|
34 |
|
|
|
35 | context "GET" do | |
|
36 | should "return issue relations" do | |
|
34 | test "GET /issues/:issue_id/relations.xml should return issue relations" do | |
|
37 | 35 |
|
|
38 | 36 | |
|
39 | 37 |
|
|
40 | 38 |
|
|
41 | 39 | |
|
42 | 40 |
|
|
43 | 41 |
|
|
44 | 42 |
|
|
45 | 43 |
|
|
46 | 44 |
|
|
47 | 45 |
|
|
48 | 46 |
|
|
49 | 47 |
|
|
50 | 48 |
|
|
51 | 49 |
|
|
52 | end | |
|
53 | 50 | |
|
54 | context "POST" do | |
|
55 | should "create a relation" do | |
|
51 | test "POST /issues/:issue_id/relations.xml should create the relation" do | |
|
56 | 52 |
|
|
57 | 53 |
|
|
58 | 54 |
|
|
59 | 55 | |
|
60 | 56 |
|
|
61 | 57 |
|
|
62 | 58 |
|
|
63 | 59 |
|
|
64 | 60 | |
|
65 | 61 |
|
|
66 | 62 |
|
|
67 | 63 |
|
|
68 | 64 |
|
|
69 | 65 | |
|
70 | context "with failure" do | |
|
71 | should "return the errors" do | |
|
66 | test "POST /issues/:issue_id/relations.xml with failure should return errors" do | |
|
72 | 67 |
|
|
73 | 68 |
|
|
74 | 69 |
|
|
75 | 70 | |
|
76 | 71 |
|
|
77 | 72 |
|
|
78 | 73 |
|
|
79 | end | |
|
80 | end | |
|
81 | end | |
|
82 | 74 | |
|
83 | context "/relations/:id" do | |
|
84 | context "GET" do | |
|
85 | should "return the relation" do | |
|
75 | test "GET /relations/:id.xml should return the relation" do | |
|
86 | 76 |
|
|
87 | 77 | |
|
88 | 78 |
|
|
89 | 79 |
|
|
90 | 80 |
|
|
91 | 81 |
|
|
92 | end | |
|
93 | 82 | |
|
94 | context "DELETE" do | |
|
95 | should "delete the relation" do | |
|
83 | test "DELETE /relations/:id.xml should delete the relation" do | |
|
96 | 84 |
|
|
97 | 85 |
|
|
98 | 86 |
|
|
99 | 87 | |
|
100 | 88 |
|
|
101 | 89 |
|
|
102 | 90 |
|
|
103 | 91 |
|
|
104 | 92 |
|
|
105 | end | |
|
106 | end |
@@ -1,51 +1,46 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::IssueStatusesTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :issue_statuses |
|
22 | 22 | |
|
23 | 23 | def setup |
|
24 | 24 | Setting.rest_api_enabled = '1' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 | context "/issue_statuses" do | |
|
28 | context "GET" do | |
|
29 | ||
|
30 | should "return issue statuses" do | |
|
27 | test "GET /issue_statuses.xml should return issue statuses" do | |
|
31 | 28 |
|
|
32 | 29 | |
|
33 | 30 |
|
|
34 | 31 |
|
|
35 | 32 |
|
|
36 | 33 |
|
|
37 | 34 |
|
|
38 | 35 |
|
|
39 | 36 |
|
|
40 | 37 |
|
|
41 | 38 |
|
|
42 | 39 |
|
|
43 | 40 |
|
|
44 | 41 |
|
|
45 | 42 |
|
|
46 | 43 |
|
|
47 | 44 |
|
|
48 | 45 |
|
|
49 | 46 |
|
|
50 | end | |
|
51 | end |
@@ -1,200 +1,172 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::MembershipsTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :projects, :users, :roles, :members, :member_roles |
|
22 | 22 | |
|
23 | 23 | def setup |
|
24 | 24 | Setting.rest_api_enabled = '1' |
|
25 | 25 | end |
|
26 | 26 | |
|
27 |
|
|
|
28 | context "GET" do | |
|
29 | context "xml" do | |
|
30 | should "return memberships" do | |
|
27 | test "GET /projects/:project_id/memberships.xml should return memberships" do | |
|
31 | 28 |
|
|
32 | 29 | |
|
33 | 30 |
|
|
34 | 31 |
|
|
35 | 32 |
|
|
36 | 33 |
|
|
37 | 34 |
|
|
38 | 35 |
|
|
39 | 36 |
|
|
40 | 37 |
|
|
41 | 38 |
|
|
42 | 39 |
|
|
43 | 40 |
|
|
44 | 41 |
|
|
45 | 42 |
|
|
46 | 43 |
|
|
47 | 44 |
|
|
48 | 45 |
|
|
49 | 46 |
|
|
50 | 47 |
|
|
51 | 48 |
|
|
52 | 49 |
|
|
53 | 50 |
|
|
54 | 51 |
|
|
55 | 52 |
|
|
56 | end | |
|
57 | 53 | |
|
58 | context "json" do | |
|
59 | should "return memberships" do | |
|
54 | test "GET /projects/:project_id/memberships.json should return memberships" do | |
|
60 | 55 |
|
|
61 | 56 | |
|
62 | 57 |
|
|
63 | 58 |
|
|
64 | 59 |
|
|
65 | 60 |
|
|
66 | 61 |
|
|
67 | 62 |
|
|
68 | 63 |
|
|
69 | 64 |
|
|
70 | 65 |
|
|
71 | 66 |
|
|
72 | 67 |
|
|
73 | 68 |
|
|
74 | 69 |
|
|
75 | 70 |
|
|
76 | 71 |
|
|
77 | 72 |
|
|
78 | 73 |
|
|
79 | 74 |
|
|
80 | end | |
|
81 | end | |
|
82 | 75 | |
|
83 | context "POST" do | |
|
84 | context "xml" do | |
|
85 | should "create membership" do | |
|
76 | test "POST /projects/:project_id/memberships.xml should create the membership" do | |
|
86 | 77 |
|
|
87 | 78 |
|
|
88 | 79 | |
|
89 | 80 |
|
|
90 | 81 |
|
|
91 | 82 |
|
|
92 | 83 | |
|
93 | should "return errors on failure" do | |
|
84 | test "POST /projects/:project_id/memberships.xml with invalid parameters should return errors" do | |
|
94 | 85 |
|
|
95 | 86 |
|
|
96 | 87 | |
|
97 | 88 |
|
|
98 | 89 |
|
|
99 | 90 |
|
|
100 | 91 |
|
|
101 | 92 |
|
|
102 | end | |
|
103 | end | |
|
104 | end | |
|
105 | 93 | |
|
106 | context "/memberships/:id" do | |
|
107 | context "GET" do | |
|
108 | context "xml" do | |
|
109 | should "return the membership" do | |
|
94 | test "GET /memberships/:id.xml should return the membership" do | |
|
110 | 95 |
|
|
111 | 96 | |
|
112 | 97 |
|
|
113 | 98 |
|
|
114 | 99 |
|
|
115 | 100 |
|
|
116 | 101 |
|
|
117 | 102 |
|
|
118 | 103 |
|
|
119 | 104 |
|
|
120 | 105 |
|
|
121 | 106 |
|
|
122 | 107 |
|
|
123 | 108 |
|
|
124 | 109 |
|
|
125 | 110 |
|
|
126 | 111 |
|
|
127 | 112 |
|
|
128 | 113 |
|
|
129 | 114 |
|
|
130 | 115 |
|
|
131 | end | |
|
132 | 116 | |
|
133 | context "json" do | |
|
134 | should "return the membership" do | |
|
117 | test "GET /memberships/:id.json should return the membership" do | |
|
135 | 118 |
|
|
136 | 119 | |
|
137 | 120 |
|
|
138 | 121 |
|
|
139 | 122 |
|
|
140 | 123 |
|
|
141 | 124 |
|
|
142 | 125 |
|
|
143 | 126 |
|
|
144 | 127 |
|
|
145 | 128 |
|
|
146 | 129 |
|
|
147 | 130 |
|
|
148 | 131 |
|
|
149 | end | |
|
150 | end | |
|
151 | 132 | |
|
152 | context "PUT" do | |
|
153 | context "xml" do | |
|
154 | should "update membership" do | |
|
133 | test "PUT /memberships/:id.xml should update the membership" do | |
|
155 | 134 |
|
|
156 | 135 |
|
|
157 | 136 |
|
|
158 | 137 | |
|
159 | 138 |
|
|
160 | 139 |
|
|
161 | 140 |
|
|
162 | 141 |
|
|
163 | 142 |
|
|
164 | 143 |
|
|
165 | 144 | |
|
166 | should "return errors on failure" do | |
|
145 | test "PUT /memberships/:id.xml with invalid parameters should return errors" do | |
|
167 | 146 |
|
|
168 | 147 | |
|
169 | 148 |
|
|
170 | 149 |
|
|
171 | 150 |
|
|
172 | 151 |
|
|
173 | end | |
|
174 | end | |
|
175 | 152 | |
|
176 | context "DELETE" do | |
|
177 | context "xml" do | |
|
178 | should "destroy membership" do | |
|
153 | test "DELETE /memberships/:id.xml should destroy the membership" do | |
|
179 | 154 |
|
|
180 | 155 |
|
|
181 | 156 | |
|
182 | 157 |
|
|
183 | 158 |
|
|
184 | 159 |
|
|
185 | 160 |
|
|
186 | 161 |
|
|
187 | 162 | |
|
188 |
|
|
|
163 | test "DELETE /memberships/:id.xml should respond with 422 on failure" do | |
|
189 | 164 |
|
|
190 | 165 |
|
|
191 | 166 |
|
|
192 | 167 |
|
|
193 | 168 | |
|
194 | 169 |
|
|
195 | 170 |
|
|
196 | 171 |
|
|
197 | 172 | end |
|
198 | end | |
|
199 | end | |
|
200 | end |
@@ -1,97 +1,84 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 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::NewsTest < Redmine::ApiTest::Base |
|
21 | 21 | fixtures :projects, :trackers, :issue_statuses, :issues, |
|
22 | 22 | :enumerations, :users, :issue_categories, |
|
23 | 23 | :projects_trackers, |
|
24 | 24 | :roles, |
|
25 | 25 | :member_roles, |
|
26 | 26 | :members, |
|
27 | 27 | :enabled_modules, |
|
28 | 28 | :news |
|
29 | 29 | |
|
30 | 30 | def setup |
|
31 | 31 | Setting.rest_api_enabled = '1' |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | context "GET /news" do | |
|
35 | context ".xml" do | |
|
36 | should "return news" do | |
|
34 | should_allow_api_authentication(:get, "/projects/onlinestore/news.xml") | |
|
35 | should_allow_api_authentication(:get, "/projects/onlinestore/news.json") | |
|
36 | ||
|
37 | test "GET /news.xml should return news" do | |
|
37 | 38 |
|
|
38 | 39 | |
|
39 | 40 |
|
|
40 | 41 |
|
|
41 | 42 |
|
|
42 | 43 |
|
|
43 | 44 |
|
|
44 | 45 |
|
|
45 | 46 |
|
|
46 | 47 |
|
|
47 | 48 |
|
|
48 | 49 |
|
|
49 | end | |
|
50 | 50 | |
|
51 | context ".json" do | |
|
52 | should "return news" do | |
|
51 | test "GET /news.json should return news" do | |
|
53 | 52 |
|
|
54 | 53 | |
|
55 | 54 |
|
|
56 | 55 |
|
|
57 | 56 |
|
|
58 | 57 |
|
|
59 | 58 |
|
|
60 | 59 |
|
|
61 | end | |
|
62 | end | |
|
63 | 60 | |
|
64 |
|
|
|
65 | context ".xml" do | |
|
66 | should_allow_api_authentication(:get, "/projects/onlinestore/news.xml") | |
|
67 | ||
|
68 | should "return news" do | |
|
61 | test "GET /projects/:project_id/news.xml should return news" do | |
|
69 | 62 |
|
|
70 | 63 | |
|
71 | 64 |
|
|
72 | 65 |
|
|
73 | 66 |
|
|
74 | 67 |
|
|
75 | 68 |
|
|
76 | 69 |
|
|
77 | 70 |
|
|
78 | 71 |
|
|
79 | 72 |
|
|
80 | 73 |
|
|
81 | end | |
|
82 | ||
|
83 | context ".json" do | |
|
84 | should_allow_api_authentication(:get, "/projects/onlinestore/news.json") | |
|
85 | 74 | |
|
86 | should "return news" do | |
|
75 | test "GET /projects/:project_id/news.json should return news" do | |
|
87 | 76 |
|
|
88 | 77 | |
|
89 | 78 |
|
|
90 | 79 |
|
|
91 | 80 |
|
|
92 | 81 |
|
|
93 | 82 |
|
|
94 | 83 |
|
|
95 | 84 |
|
|
96 | end | |
|
97 | end |
General Comments 0
You need to be logged in to leave comments.
Login now