Skip to content

Commit

Permalink
Add first test
Browse files Browse the repository at this point in the history
  • Loading branch information
fliiiix committed Sep 30, 2023
1 parent cdb32e1 commit f7bf25f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ jobs:
run: black --check --line-length 120 pandoc_plantuml_filter.py tests setup.py
- name: black format check
run: flake8 --max-line-length 120 pandoc_plantuml_filter.py tests setup.py
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Setup build and test environment
run: python -m pip install --upgrade pip setuptools wheel pytest pytest-mock
- name: run tests
run: pytest

18 changes: 18 additions & 0 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pytest

from pandoc_plantuml_filter import plantuml


def test_call_plantuml_create_para_object(mocker):
mocker.patch("os.path.isfile", return_value=False)
mock = mocker.patch("subprocess.check_call")

ret = plantuml(
key="CodeBlock", value=[["", ["plantuml"], []], ""], format_=None, meta={}
)

assert isinstance(ret, dict)
assert "t" in ret.keys()
assert ret["t"] == "Para"

mock.assert_called_once()

0 comments on commit f7bf25f

Please sign in to comment.