def test_get_spec_path_preferred_format( json_path, yaml_path, preferred_format, expected_result ): docs = OpenAPIHandler( info=Info("Example", "0.0.1"), json_spec_path=json_path, yaml_spec_path=yaml_path, preferred_format=preferred_format, ) assert docs.get_spec_path() == expected_result
def test_get_spec_path_raises_for_unsupported_preferred_format(): docs = OpenAPIHandler(info=Info("Example", "0.0.1")) docs.preferred_format = "NOPE" # type: ignore with pytest.raises(OpenAPIEndpointException): docs.get_spec_path()