From d2e4fe613611bab046d1eddd8b031d114dbc3f73 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 12 Jul 2022 06:44:16 -0400 Subject: [PATCH] UT: Break up large unit test into smaller tests --- .../cc/resources/test_propagation_credentials.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py index ee78e7a72..111ad7e30 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_propagation_credentials.py @@ -124,14 +124,17 @@ def test_propagation_credentials_endpoint__propagation_credentials_post_not_allo assert resp.status_code == HTTPStatus.METHOD_NOT_ALLOWED -def test_propagation_credentials_endpoint__not_found(flask_client): - non_existent_collection_url = urljoin(ALL_CREDENTIALS_URL, "bogus-credentials") +NON_EXISTENT_COLLECTION_URL = urljoin(ALL_CREDENTIALS_URL, "bogus-credentials") - resp = flask_client.get(non_existent_collection_url) + +def test_propagation_credentials_endpoint__get_not_found(flask_client): + resp = flask_client.get(NON_EXISTENT_COLLECTION_URL) assert resp.status_code == HTTPStatus.NOT_FOUND + +def test_propagation_credentials_endpoint__post_not_found(flask_client): resp = flask_client.post( - non_existent_collection_url, + NON_EXISTENT_COLLECTION_URL, json=[ Credentials.to_json(PROPAGATION_CREDENTIALS_2), Credentials.to_json(PROPAGATION_CREDENTIALS_3), @@ -139,5 +142,7 @@ def test_propagation_credentials_endpoint__not_found(flask_client): ) assert resp.status_code == HTTPStatus.NOT_FOUND - resp = flask_client.delete(non_existent_collection_url) + +def test_propagation_credentials_endpoint__delete_not_found(flask_client): + resp = flask_client.delete(NON_EXISTENT_COLLECTION_URL) assert resp.status_code == HTTPStatus.NOT_FOUND