@@ -152,7 +152,8 @@ class ReportsControllerTest < ActionController::TestCase
152
152
153
153
test "should get usage" do
154
154
get :usage , :user_id => @not_admin . id
155
- assert_response :success
155
+ assert_response :forbidden # disabled for hoc
156
+ #assert_response :success
156
157
end
157
158
158
159
test "should not get usage if not signed in" do
@@ -166,17 +167,18 @@ class ReportsControllerTest < ActionController::TestCase
166
167
sign_in @not_admin
167
168
168
169
get :usage , :user_id => @not_admin . id
169
-
170
- assert_response :success
170
+ assert_response :forbidden # disabled for hoc
171
+ # assert_response :success
171
172
end
172
173
173
174
174
175
test "should get usage for students if teacher" do
175
176
sign_in @teacher
176
177
177
178
get :usage , :user_id => @student . id
179
+ assert_response :forbidden # disabled for hoc
178
180
179
- assert_response :success
181
+ # assert_response :success
180
182
end
181
183
182
184
test "should not get usage for other users if not admin or teacher" do
@@ -216,11 +218,30 @@ class ReportsControllerTest < ActionController::TestCase
216
218
assert_redirected_to_sign_in
217
219
end
218
220
219
- generate_admin_only_tests_for :all_usage
221
+ def self . generate_admin_forbidden_tests_for ( action , params = { } )
222
+ test "should get #{ action } " do
223
+ get action , params
224
+ assert_response :forbidden
225
+ end
220
226
221
- generate_admin_only_tests_for :admin_stats
227
+ test "should not get #{ action } if not signed in" do
228
+ sign_out @admin
229
+ get action , params
230
+ assert_redirected_to_sign_in
231
+ end
222
232
223
- generate_admin_only_tests_for :admin_gallery
233
+ test "should not get #{ action } if not admin" do
234
+ sign_in @not_admin
235
+ get action , params
236
+ assert_response :forbidden
237
+ end
238
+ end
239
+
240
+ generate_admin_forbidden_tests_for :all_usage # disabled for hoc
241
+
242
+ generate_admin_forbidden_tests_for :admin_stats # disabled for hoc
243
+
244
+ generate_admin_forbidden_tests_for :admin_gallery # disabled for hoc
224
245
225
246
test "admin_gallery shows most recent 25 gallery items" do
226
247
sign_in @admin
@@ -230,8 +251,9 @@ class ReportsControllerTest < ActionController::TestCase
230
251
end
231
252
232
253
get :admin_gallery
254
+ assert_response :forbidden # disabled for hoc
233
255
234
- assert_equal 25 , assigns ( :gallery_activities ) . count
256
+ # assert_equal 25, assigns(:gallery_activities).count
235
257
end
236
258
237
259
test "students should redirect to new teacher dashboard" do
@@ -241,7 +263,9 @@ class ReportsControllerTest < ActionController::TestCase
241
263
242
264
test "should get level_stats" do
243
265
get :level_stats , { :level_id => create ( :level ) . id }
244
- assert_response :success
266
+
267
+ assert_response :forbidden # disabled for hoc
268
+ # assert_response :success
245
269
end
246
270
247
271
test "should not get level_stats if not admin" do
@@ -325,7 +349,8 @@ class ReportsControllerTest < ActionController::TestCase
325
349
326
350
test 'should get admin progress' do
327
351
get :admin_progress
328
- assert_select 'h1' , 'Admin progress'
352
+ assert_response :forbidden # disabled for hoc
353
+ # assert_select 'h1', 'Admin progress'
329
354
end
330
355
331
356
end
0 commit comments