- post :unsubscribe, :id => changeset.id
- end
- assert_response :not_found
- end
-
- ##
- # test hide comment fail
- def test_hide_comment_fail
- # unauthorized
- comment = changeset_comments(:normal_comment_1)
- assert("comment.visible") do
- post :hide_comment, :id => comment.id
- assert_response :unauthorized
- end
-
- basic_authorization(users(:public_user).email, "test")
-
- # not a moderator
- assert("comment.visible") do
- post :hide_comment, :id => comment.id
- assert_response :forbidden
- end
-
- basic_authorization(users(:moderator_user).email, "test")
-
- # bad comment id
- post :hide_comment, :id => 999111
- assert_response :not_found
- end
-
- ##
- # test hide comment succes
- def test_hide_comment_success
- comment = changeset_comments(:normal_comment_1)
-
- basic_authorization(users(:moderator_user).email, "test")
-
- assert("!comment.visible") do
- post :hide_comment, :id => comment.id
- end
- assert_response :success
- end
-
- ##
- # test unhide comment fail
- def test_unhide_comment_fail
- # unauthorized
- comment = changeset_comments(:normal_comment_1)
- assert("comment.visible") do
- post :unhide_comment, :id => comment.id
- assert_response :unauthorized
- end
-
- basic_authorization(users(:public_user).email, "test")
-
- # not a moderator
- assert("comment.visible") do
- post :unhide_comment, :id => comment.id
- assert_response :forbidden