From f85d6b40501333af9e8f69d8f8d7fdcae9e3de8f Mon Sep 17 00:00:00 2001 From: Alex Okolish Date: Mon, 27 Jan 2025 11:46:50 -0800 Subject: [PATCH] Return 200 even if exchange doesn't exist for deletes --- .../src/OpenMediaMatch/blueprints/curation.py | 4 ---- .../src/OpenMediaMatch/tests/test_api.py | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/hasher-matcher-actioner/src/OpenMediaMatch/blueprints/curation.py b/hasher-matcher-actioner/src/OpenMediaMatch/blueprints/curation.py index 54700df12..04399e436 100644 --- a/hasher-matcher-actioner/src/OpenMediaMatch/blueprints/curation.py +++ b/hasher-matcher-actioner/src/OpenMediaMatch/blueprints/curation.py @@ -441,10 +441,6 @@ def exchange_delete(exchange_name: str): } """ storage = persistence.get_storage() - collab = storage.exchange_get(exchange_name) - if collab is None: - abort(404, f"exchange '{exchange_name}' not found") - storage.exchange_delete(exchange_name) return {"message": "Exchange deleted"} diff --git a/hasher-matcher-actioner/src/OpenMediaMatch/tests/test_api.py b/hasher-matcher-actioner/src/OpenMediaMatch/tests/test_api.py index 5c2f10da7..508034d25 100644 --- a/hasher-matcher-actioner/src/OpenMediaMatch/tests/test_api.py +++ b/hasher-matcher-actioner/src/OpenMediaMatch/tests/test_api.py @@ -169,9 +169,8 @@ def test_exchange_delete(app: Flask, client: FlaskClient): delete_response = client.delete( "/c/exchange/TEST_EXCHANGE", ) - # test exchange not found - assert delete_response.status_code == 404 - assert delete_response.get_json()["message"] == "exchange 'TEST_EXCHANGE' not found" + # deleting an exchange that doesn't exist returns 200 + assert delete_response.status_code == 200 # create an exchange post_response = client.post( @@ -180,7 +179,7 @@ def test_exchange_delete(app: Flask, client: FlaskClient): ) assert post_response.status_code == 201 - # test a successful delete + # test a real delete delete_response = client.delete( "/c/exchange/FOO_EXCHANGE", )