openapi-core/tests/integration/schema/test_path_params.py

28 lines
655 B
Python
Raw Normal View History

2021-04-27 21:39:28 +00:00
from __future__ import division
2019-03-08 09:19:09 +00:00
import pytest
from openapi_core.shortcuts import create_spec
class TestMinimal(object):
spec_paths = [
"data/v3.0/path_param.yaml"
]
@pytest.mark.parametrize("spec_path", spec_paths)
def test_param_present(self, factory, spec_path):
spec_dict = factory.spec_from_file(spec_path)
spec = create_spec(spec_dict)
2021-04-23 11:36:27 +00:00
path = spec / 'paths#/resource/{resId}'
2019-03-08 09:19:09 +00:00
2021-04-23 11:36:27 +00:00
parameters = path / 'parameters'
assert len(parameters) == 1
param = parameters[0]
assert param['name'] == 'resId'
assert param['required']
assert param['in'] == 'path'