24 lines
652 B
Python
24 lines
652 B
Python
import sys
|
|
from io import StringIO
|
|
from unittest import mock
|
|
from redmine_reporter.cli import main
|
|
|
|
|
|
@mock.patch.dict("os.environ", {
|
|
"REDMINE_URL": "https://red.eltex.loc/",
|
|
"REDMINE_USER": "x",
|
|
"REDMINE_PASSWORD": "y"
|
|
})
|
|
@mock.patch("redmine_reporter.client.fetch_issues_with_spent_time")
|
|
def test_cli_smoke(mock_fetch):
|
|
mock_fetch.return_value = []
|
|
old_stdout = sys.stdout
|
|
sys.stdout = captured = StringIO()
|
|
try:
|
|
code = main(["--date", "2026-01-01--2026-01-31"])
|
|
assert code == 0
|
|
output = captured.getvalue()
|
|
assert "Total issues: 0" in output
|
|
finally:
|
|
sys.stdout = old_stdout
|