From e1759a7906d243e1a8a92bdb6474688d8d1693e0 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Thu, 8 Sep 2022 14:53:01 +0530 Subject: [PATCH] UT: Simplify parametrize logic in test_find_server() --- .../network/relay/test_utils.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/monkey/tests/unit_tests/infection_monkey/network/relay/test_utils.py b/monkey/tests/unit_tests/infection_monkey/network/relay/test_utils.py index fa63d34cb..1acd08012 100644 --- a/monkey/tests/unit_tests/infection_monkey/network/relay/test_utils.py +++ b/monkey/tests/unit_tests/infection_monkey/network/relay/test_utils.py @@ -16,23 +16,11 @@ servers = [SERVER_1, SERVER_2, SERVER_3, SERVER_4] @pytest.mark.parametrize( "expected_server,server_response_pairs", [ - ( - None, - [ - (SERVER_1, {"exc": requests.exceptions.ConnectionError}), - (SERVER_2, {"exc": requests.exceptions.ConnectionError}), - (SERVER_3, {"exc": requests.exceptions.ConnectionError}), - (SERVER_4, {"exc": requests.exceptions.ConnectionError}), - ], - ), + (None, [(server, {"exc": requests.exceptions.ConnectionError}) for server in servers]), ( SERVER_2, - [ - (SERVER_1, {"exc": requests.exceptions.ConnectionError}), - (SERVER_2, {"text": ""}), - (SERVER_3, {"text": ""}), - (SERVER_4, {"text": ""}), - ], + [(SERVER_1, {"exc": requests.exceptions.ConnectionError})] + + [(server, {"text": ""}) for server in servers[1:]], ), ], )