Example #1
0
def test_convert_petstore_json(petstore_json):
    converted, content_type = convert.convert_str(petstore_json)

    # Check correct content type
    assert 'json' in content_type

    # Parsing can't fail.
    from prance.util import formats
    parsed = formats.parse_spec(converted, content_type=content_type)

    # Assert the correct target version
    assert 'openapi' in parsed
    assert parsed['openapi'].startswith('3.')
Example #2
0
def test_convert_petstore_yaml(petstore_yaml):
    converted, content_type = convert.convert_str(petstore_yaml)

    # Check correct content type
    assert "yaml" in content_type

    # Parsing can't fail.
    from prance.util import formats

    parsed = formats.parse_spec(converted, content_type=content_type)

    # Assert the correct target version
    assert "openapi" in parsed
    assert parsed["openapi"].startswith("3.")
Example #3
0
def test_convert_petstore_yaml_explicit_name(petstore_yaml):
    converted, content_type = convert.convert_str(petstore_yaml,
                                                  filename='foo.yml')

    # Check correct content type
    assert 'yaml' in content_type