MIL-002: Step 1 - User interface
Review record RC-024 (Go, autonomous mode, not independent). Task: MIL-002#1 Task: MIL-002#2 Task: MIL-002#3 Task: MIL-002#4
This commit is contained in:
+20
-4
@@ -1,11 +1,27 @@
|
||||
"""Tests of the entry point.
|
||||
|
||||
@file test_app.py
|
||||
@brief Checks main of flash_card.presentation.app.
|
||||
@brief Checks main of flash_card.presentation.app without opening a window.
|
||||
"""
|
||||
|
||||
from flash_card.presentation.app import main
|
||||
import pytest
|
||||
|
||||
from flash_card.presentation import app
|
||||
|
||||
|
||||
def test_main_returns_zero_without_arguments() -> None:
|
||||
assert main([]) == 0
|
||||
class _FakeRoot:
|
||||
def __init__(self) -> None:
|
||||
self.mainloop_calls = 0
|
||||
|
||||
def mainloop(self) -> None:
|
||||
self.mainloop_calls += 1
|
||||
|
||||
|
||||
def test_main_runs_main_loop_and_returns_zero(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
root = _FakeRoot()
|
||||
monkeypatch.setattr(app, "create_application", lambda: (root, object()))
|
||||
|
||||
assert app.main([]) == 0
|
||||
assert root.mainloop_calls == 1
|
||||
|
||||
Reference in New Issue
Block a user