mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 14:05:59 -03:30
Generate schema suitable for comparing for schema changes
This commit is contained in:
committed by
Elijah DeLee
parent
9b992c971e
commit
f737fc066f
@@ -49,7 +49,8 @@ class TestSwaggerGeneration():
|
||||
data.update(response.accepted_renderer.get_customizations() or {})
|
||||
|
||||
data['host'] = None
|
||||
data['modified'] = datetime.datetime.utcnow().isoformat()
|
||||
if not pytest.config.getoption("--genschema"):
|
||||
data['modified'] = datetime.datetime.utcnow().isoformat()
|
||||
data['schemes'] = ['https']
|
||||
data['consumes'] = ['application/json']
|
||||
|
||||
@@ -139,11 +140,14 @@ class TestSwaggerGeneration():
|
||||
for param in node[method].get('parameters'):
|
||||
if param['in'] == 'body':
|
||||
node[method]['parameters'].remove(param)
|
||||
node[method].setdefault('parameters', []).append({
|
||||
'name': 'data',
|
||||
'in': 'body',
|
||||
'schema': {'example': request_data},
|
||||
})
|
||||
if pytest.config.getoption("--genschema"):
|
||||
pytest.skip("In schema generator skipping swagger generator", allow_module_level=True)
|
||||
else:
|
||||
node[method].setdefault('parameters', []).append({
|
||||
'name': 'data',
|
||||
'in': 'body',
|
||||
'schema': {'example': request_data},
|
||||
})
|
||||
|
||||
# Build response examples
|
||||
if resp:
|
||||
@@ -168,4 +172,9 @@ class TestSwaggerGeneration():
|
||||
'2018-02-01T08:00:00.000000Z',
|
||||
data
|
||||
)
|
||||
data = re.sub(
|
||||
'''(\s+"client_id": ")([a-zA-Z0-9]{40})("\,\s*)''',
|
||||
'\\1xxxx\\3',
|
||||
data
|
||||
)
|
||||
f.write(data)
|
||||
|
||||
Reference in New Issue
Block a user