-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from macisamuele/maci-add-connection-error-sup…
…port-and-bravado-integration-tests Add connection error support and bravado integration tests
- Loading branch information
Showing
5 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import aiohttp.client_exceptions | ||
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 | ||
|
||
|
||
class TestServerBravadoAsyncioClient(IntegrationTestsBaseClass): | ||
|
||
http_client_type = AsyncioClient | ||
http_future_adapter_type = FutureAdapter | ||
connection_errors_exceptions = { | ||
aiohttp.ClientConnectionError(), | ||
} | ||
|
||
def cancel_http_future(self, http_future): | ||
http_future.future.future.cancel() | ||
|
||
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), | ||
'params': {}, | ||
}).result(timeout=1) | ||
|
||
assert response.text == self.encode_expected_response(ROUTE_1_RESPONSE) |