Skip to content

Commit

Permalink
Update test_uniform_federation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
daisieh committed Oct 2, 2024
1 parent 9f168a2 commit a28d768
Showing 1 changed file with 0 additions and 66 deletions.
66 changes: 0 additions & 66 deletions tests/test_uniform_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,72 +360,6 @@ def test_valid_asyncRequests_two_servers_post(mock_requests, client, two_servers
assert Success == [200, 200]


@patch('federation.requests.post', side_effect=exceptions.ConnectionError)
def test_invalid_asyncRequests_two_servers_get(mock_requests, client, two_servers):
with client:
FR = get_federation_response("POST")
resp = FR.async_requests(request='GET',
endpoint_path=TestParams["path"],
endpoint_payload="",
header=TestParams["Headers"],
endpoint_service=TestParams["service"])
ConnErrs = list(map(lambda a: a["response"] is None, resp.values()))

# Error should just be propagated through since handle_server_request will address it

assert len(resp) == 2
assert ConnErrs == [True, True]


@patch('federation.requests.post', side_effect=exceptions.ConnectionError)
def test_invalid_asyncRequests_two_servers_post(mock_requests, client, two_servers):
with client:
FR = get_federation_response("POST")
resp = FR.async_requests(request='POST',
endpoint_path=TestParams["path"],
endpoint_payload="",
header=TestParams["Headers"],
endpoint_service=TestParams["service"])

Success = list(map(lambda a: "ConnectionError" in str(a), resp.values()))

assert len(resp) == 2
assert Success == [True, True]


@patch('federation.requests.post', side_effect=exceptions.Timeout)
def test_timeout_asyncRequests_two_servers_post(mock_requests, client, two_servers):
with client:
FR = get_federation_response("POST")
resp = FR.async_requests(request='POST',
endpoint_path=TestParams["path"],
endpoint_payload="",
header=TestParams["Headers"],
endpoint_service=TestParams["service"])

Success = list(map(lambda a: "Timeout" in str(a), resp.values()))

assert len(resp) == 2
assert Success == [True, True]


@patch('federation.requests.post', side_effect=exceptions.Timeout)
def test_timeout_asyncRequests_two_servers_get(mock_requests, client, two_servers):
with client:
FR = get_federation_response("GET")
resp = FR.async_requests(request='GET',
endpoint_path=TestParams["path"],
endpoint_payload="",
header=TestParams["Headers"],
endpoint_service=TestParams["service"])

TimeoutErrs = list(map(lambda a: "Timeout" in str(a), resp.values()))

# Error should just be propagated through since handle_server_request will address it

assert len(resp) == 2
assert TimeoutErrs == [True, True]

# Test Federation with one server --------------------------------------------------------------------

@patch('federation.requests.Session.get', side_effect=mocked_service_get)
Expand Down

0 comments on commit a28d768

Please sign in to comment.