Test api changeset comment hide/unhide at legacy routes

This commit is contained in:
Anton Khorev 2025-02-23 06:45:52 +03:00
parent 3765a7e89e
commit 075f8df94a

View file

@ -114,6 +114,24 @@ module Api
check_successful_response_json(comment, :comment_visible => true) check_successful_response_json(comment, :comment_visible => true)
end end
def test_create_at_legacy_route
comment = create(:changeset_comment, :visible => false)
auth_header = bearer_authorization_header create(:moderator_user), :scopes => %w[write_api]
post "/api/0.6/changeset/comment/#{comment.id}/unhide", :headers => auth_header
check_successful_response_xml(comment, :comment_visible => true)
end
def test_create_at_legacy_route_json
comment = create(:changeset_comment, :visible => false)
auth_header = bearer_authorization_header create(:moderator_user), :scopes => %w[write_api]
post "/api/0.6/changeset/comment/#{comment.id}/unhide.json", :headers => auth_header
check_successful_response_json(comment, :comment_visible => true)
end
def test_destroy_by_unauthorized def test_destroy_by_unauthorized
comment = create(:changeset_comment) comment = create(:changeset_comment)
@ -187,6 +205,24 @@ module Api
check_successful_response_json(comment, :comment_visible => false) check_successful_response_json(comment, :comment_visible => false)
end end
def test_destroy_at_legacy_route
comment = create(:changeset_comment)
auth_header = bearer_authorization_header create(:moderator_user), :scopes => %w[write_api]
post "/api/0.6/changeset/comment/#{comment.id}/hide", :headers => auth_header
check_successful_response_xml(comment, :comment_visible => false)
end
def test_destroy_at_legacy_route_json
comment = create(:changeset_comment)
auth_header = bearer_authorization_header create(:moderator_user), :scopes => %w[write_api]
post "/api/0.6/changeset/comment/#{comment.id}/hide.json", :headers => auth_header
check_successful_response_json(comment, :comment_visible => false)
end
private private
def check_successful_response_xml(comment, comment_visible:) def check_successful_response_xml(comment, comment_visible:)