1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
"""Smoke test examples from OAI/OpenAPI-Specification repo."""
import os
import glob
import itertools
import py
import pytest
@pytest.mark.parametrize('spec', itertools.chain(
glob.glob(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'OpenAPI-Specification',
'examples',
'v2.0',
'json',
'*.json')),
glob.glob(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'OpenAPI-Specification',
'examples',
'v2.0',
'yaml',
'*.yaml')),
))
def test_openapi2_success(tmpdir, run_sphinx, spec):
py.path.local(spec).copy(tmpdir.join('src', 'test-spec.yml'))
run_sphinx('test-spec.yml')
@pytest.mark.parametrize('group_paths', [False, True])
@pytest.mark.parametrize('render_examples', [False, True])
@pytest.mark.parametrize('render_request', [False, True])
@pytest.mark.parametrize('spec', glob.glob(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'OpenAPI-Specification',
'examples',
'v3.0',
'*.yaml')
))
def test_openapi30_success(tmpdir, run_sphinx, spec, render_examples,
render_request, group_paths):
py.path.local(spec).copy(tmpdir.join('src', 'test-spec.yml'))
run_sphinx('test-spec.yml', options={
'examples': render_examples,
'request': render_request,
'group': group_paths,
})
@pytest.mark.parametrize('render_examples', [False, True])
@pytest.mark.parametrize('render_request', [False, True])
@pytest.mark.parametrize('spec', glob.glob(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'OpenAPI-Specification',
'examples',
'v3.1',
'*.yaml')
))
def test_openapi31_success(tmpdir, run_sphinx, spec, render_examples,
render_request):
py.path.local(spec).copy(tmpdir.join('src', 'test-spec.yml'))
run_sphinx('test-spec.yml', options={
'examples': render_examples,
'request': render_request,
})
|