Skip to content

Commit 5a5f766

Browse files
Fix tests
1 parent 26eac38 commit 5a5f766

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pytest
22
pytest-cov
3-
essentials-openapi[full]>=1.0.2
3+
essentials-openapi[full]>=1.2.1
44
mkdocs
55
flake8
66
black

tests/test_mkdocsoad.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import textwrap
2+
from unittest.mock import Mock
23

34
import pytest
45

@@ -7,6 +8,15 @@
78
from . import get_resource_file_path
89

910

11+
def make_mock_page(src_dir="docs", src_path="index.md"):
12+
mock_file = Mock()
13+
mock_file.src_dir = src_dir
14+
mock_file.src_path = src_path
15+
mock_page = Mock()
16+
mock_page.file = mock_file
17+
return mock_page
18+
19+
1020
def test_markdown_without_oad():
1121
handler = MkDocsOpenAPIDocumentationPlugin()
1222

@@ -20,7 +30,7 @@ def test_markdown_without_oad():
2030
)
2131
)
2232

23-
result = handler.on_page_markdown(example)
33+
result = handler.on_page_markdown(example, make_mock_page())
2434
assert result == example
2535

2636

@@ -39,7 +49,7 @@ def test_markdown_with_oad(file_name):
3949
)
4050
)
4151

42-
result = handler.on_page_markdown(example)
52+
result = handler.on_page_markdown(example, make_mock_page())
4353

4454
# Note: not testing the full output since this responsibility belongs to the
4555
# essentials-openapi package

0 commit comments

Comments
 (0)