Skip to content

Commit

Permalink
Add first test
Browse files Browse the repository at this point in the history
  • Loading branch information
fliiiix committed Oct 1, 2023
1 parent 50a04f0 commit 6ecc5d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,18 @@ jobs:
run: black --check --line-length 120 pandoc_plantuml_filter.py tests setup.py
- name: flake8 format check
run: flake8 --max-line-length 120 pandoc_plantuml_filter.py tests setup.py
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Setup package
run: python -m pip install .
- name: run tests
run: pytest

14 changes: 14 additions & 0 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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 6ecc5d9

Please sign in to comment.