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( @pytest.mark.parametrize(
"expected_server,server_response_pairs", "expected_server,server_response_pairs",
[ [
( (None, [(server, {"exc": requests.exceptions.ConnectionError}) for server in servers]),
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}),
],
),
( (
SERVER_2, SERVER_2,
[ [(SERVER_1, {"exc": requests.exceptions.ConnectionError})]
(SERVER_1, {"exc": requests.exceptions.ConnectionError}), + [(server, {"text": ""}) for server in servers[1:]],
(SERVER_2, {"text": ""}),
(SERVER_3, {"text": ""}),
(SERVER_4, {"text": ""}),
],
), ),
], ],
) )