From 97b9d5acdbbde1052cb1f21a9ca79d645b20be60 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 13 Feb 2025 02:49:54 +0300 Subject: [PATCH] Split api changeset comment hide fail tests --- .../api/changeset_comments_controller_test.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/controllers/api/changeset_comments_controller_test.rb b/test/controllers/api/changeset_comments_controller_test.rb index 4719ce49d..8a1a286df 100644 --- a/test/controllers/api/changeset_comments_controller_test.rb +++ b/test/controllers/api/changeset_comments_controller_test.rb @@ -281,30 +281,31 @@ module Api end end - ## - # test hide comment fail - def test_hide_fail - # unauthorized + def test_hide_by_unauthorized comment = create(:changeset_comment) - assert comment.visible post changeset_comment_hide_path(comment) + assert_response :unauthorized assert comment.reload.visible + end + def test_hide_by_normal_user + comment = create(:changeset_comment) auth_header = bearer_authorization_header - # not a moderator post changeset_comment_hide_path(comment), :headers => auth_header + assert_response :forbidden assert comment.reload.visible + end + def test_hide_missing_comment auth_header = bearer_authorization_header create(:moderator_user) - # bad comment id post changeset_comment_hide_path(999111), :headers => auth_header + assert_response :not_found - assert comment.reload.visible end ## -- 2.39.5