UT: Simplify parametrize logic in test_find_server()

This commit is contained in:
Shreya Malviya 2022-09-08 14:53:01 +05:30 committed by Mike Salvatore
parent fac179bbda
commit e1759a7906
1 changed files with 3 additions and 15 deletions

View File

@ -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:]],
),
],
)