Skip to content

Commit b2a25f4

Browse files
committed
Initial steps for unittests
1 parent c134609 commit b2a25f4

File tree

4 files changed

+141
-2
lines changed

4 files changed

+141
-2
lines changed

poetry.lock

Lines changed: 114 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ validators = "^0.24"
1717

1818
[poetry.group.dev.dependencies]
1919
pytest = "^8"
20+
pytest-mock = "^3.14.0"
2021
black = "^24.3"
2122
isort = "^5.13"
2223

@@ -26,3 +27,9 @@ audiness = "audiness.main:app"
2627
[build-system]
2728
requires = ["poetry-core>=1.0.0"]
2829
build-backend = "poetry.core.masonry.api"
30+
31+
[tool.pytest.ini_options]
32+
minversion = "8.0"
33+
testpaths = [
34+
"tests",
35+
]

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Tests for audiness."""

tests/test_main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Tests for main part of audiness."""
2+
from typer.testing import CliRunner
3+
4+
from audiness.main import app
5+
6+
runner = CliRunner()
7+
8+
9+
def test_app1():
10+
result = runner.invoke(app, ["--access_key"], input="123456\n")
11+
assert result.exit_code == 2
12+
13+
def test_app2():
14+
result = runner.invoke(app, ["--secret_key"], input=None)
15+
assert result.exit_code == 2
16+
17+
def test_app3():
18+
result = runner.invoke(app, ["--host"], input="https://localhost:8834\n")
19+
assert result.exit_code == 2

0 commit comments

Comments
 (0)