コード例 #1
0
def test_document_status_endpoint():
    api = spec.to_dict()
    assert '/status' in api['paths']
    assert 'get' in api['paths']['/status']
    assert '200' in api['paths']['/status']['get']['responses']
    assert 'string' in api['paths']['/status']['get']['responses']['200'][
        'schema']
コード例 #2
0
def test_document_health_endpoint():
    api = spec.to_dict()
    assert '/health' in api['paths']
    assert 'get' in api['paths']['/health']
    assert '200' in api['paths']['/health']['get']['responses']
    assert 'string' in api['paths']['/health']['get']['responses']['200'][
        'schema']
    assert '503' in api['paths']['/health']['get']['responses']
    assert 'string' in api['paths']['/health']['get']['responses']['503'][
        'schema']
コード例 #3
0
def swagger():
    """
    Responds with the OpenAPI specification for this application.
    """
    return jsonify(spec.to_dict())
コード例 #4
0
def test_document_meta():
    api = spec.to_dict()
    assert api['info']['title'] == 'flask_service'
    assert api['info']['version'] == __version__
    assert api['info']['description'] == 'My application'