mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 13:25:02 -02:30
build example Swagger request and response bodies from our API tests
This commit is contained in:
@@ -46,6 +46,13 @@ from awx.main.models.notifications import (
|
||||
from awx.main.models.workflow import WorkflowJobTemplate
|
||||
from awx.main.models.ad_hoc_commands import AdHocCommand
|
||||
|
||||
__SWAGGER_REQUESTS__ = {}
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def swagger_autogen(requests=__SWAGGER_REQUESTS__):
|
||||
return requests
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def clear_cache():
|
||||
@@ -546,6 +553,9 @@ def _request(verb):
|
||||
assert response.status_code == expect
|
||||
if hasattr(response, 'render'):
|
||||
response.render()
|
||||
__SWAGGER_REQUESTS__.setdefault(request.path, {})[
|
||||
(request.method.lower(), response.status_code)
|
||||
] = (response.get('Content-Type', None), response.content, kwargs.get('data'))
|
||||
return response
|
||||
return rf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user