-
Notifications
You must be signed in to change notification settings - Fork 8
/
bravado_integration_test.py
44 lines (36 loc) · 1.68 KB
/
bravado_integration_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import aiohttp.client_exceptions
import pytest
from bravado.testing.integration_test import IntegrationTestsBaseClass
from bravado.testing.integration_test import ROUTE_1_RESPONSE
from bravado_asyncio.future_adapter import FutureAdapter
from bravado_asyncio.http_client import AsyncioClient
@pytest.mark.skipif(
sys.platform != "linux" or sys.version_info >= (3, 7),
reason="These integration tests are failing on newer Python versions due to trying to connect to ::1 first, and failing. On Windows, they run into timeouts",
)
class TestServerBravadoAsyncioClient(IntegrationTestsBaseClass): # pragma: no cover
http_client_type = AsyncioClient
http_future_adapter_type = FutureAdapter
connection_errors_exceptions = {aiohttp.ClientConnectionError()}
def test_bytes_header(self, swagger_http_server):
# TODO: integrate this test into bravado integration tests suite
response = self.http_client.request(
{
"method": "GET",
"headers": {"byte-header": b"1"},
"url": "{server_address}/1".format(server_address=swagger_http_server),
# setting high timeouts here so we don't get coverage errors on Windows on Azure Pipelines
"params": {"timeout": 5, "connect_timeout": 1},
}
).result(timeout=5)
assert response.text == self.encode_expected_response(
ROUTE_1_RESPONSE
) # pragma: no cover
@pytest.mark.skip(
reason="Test started failing; also causing hangs on GH Action on Win/Py37"
)
def test_request_timeout_errors_are_thrown_as_BravadoTimeoutError(
self, swagger_http_server
):
pass