Skip to content

Commit 1a78a14

Browse files
author
Nikita Filonov
committed
tests
1 parent 0701e9f commit 1a78a14

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

ui_coverage_tool/tests/fixtures/config.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
from pathlib import Path
22

33
import pytest
4+
from pydantic import HttpUrl
45

5-
from ui_coverage_tool.config import Settings
6+
from ui_coverage_tool.config import Settings, AppConfig
7+
from ui_coverage_tool.src.tools.types import AppKey, AppName
68

79

810
@pytest.fixture
911
def settings(tmp_path: Path) -> Settings:
1012
results_dir = tmp_path / "results"
1113
results_dir.mkdir(parents=True, exist_ok=True)
12-
return Settings(results_dir=results_dir)
14+
return Settings(
15+
apps=[
16+
AppConfig(
17+
url=HttpUrl("https://example.com/login"),
18+
key=AppKey("test-service"),
19+
name=AppName("Test Service")
20+
)
21+
],
22+
results_dir=results_dir
23+
)
1324

1425

1526
@pytest.fixture

ui_coverage_tool/tests/suites/src/history/test_builder.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ def build_new() -> ElementHistory:
7373
assert result[0].created_at < result[1].created_at
7474

7575

76-
def test_append_history_returns_empty_if_no_history_file(tmp_path: Path) -> None:
77-
settings = Settings(results_dir=tmp_path / "results")
76+
def test_append_history_returns_empty_if_no_history_file(
77+
tmp_path: Path,
78+
settings: Settings
79+
) -> None:
80+
settings.results_dir = tmp_path / "results"
7881
settings.history_file = None
7982
builder = UICoverageHistoryBuilder(AppHistoryState(), settings)
8083

ui_coverage_tool/tests/suites/src/reports/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_init_creates_valid_report_state(settings: Settings) -> None:
3232

3333

3434
def test_init_with_empty_settings() -> None:
35-
empty_settings = Settings()
35+
empty_settings = Settings(apps=[])
3636
state = CoverageReportState.init(empty_settings)
3737

3838
assert isinstance(state, CoverageReportState)

ui_coverage_tool/tests/suites/src/tracker/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_init_uses_default_settings(monkeypatch: pytest.MonkeyPatch) -> None:
2525

2626
def fake_get_settings() -> Settings:
2727
called["used"] = True
28-
return Settings()
28+
return Settings(apps=[])
2929

3030
monkeypatch.setattr("ui_coverage_tool.src.tracker.core.get_settings", fake_get_settings)
3131

ui_coverage_tool/tests/suites/src/tracker/test_storage.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ def test_save_creates_json_file(
3232
def test_save_creates_dir_if_missing(
3333
caplog: pytest.LogCaptureFixture,
3434
tmp_path: Path,
35+
settings: Settings,
3536
coverage_result: CoverageResult,
3637
) -> None:
3738
results_dir: Path = tmp_path / "nested" / "results"
38-
settings = Settings(results_dir=results_dir)
39+
settings.results_dir = results_dir
3940
storage = UICoverageTrackerStorage(settings)
4041

4142
assert not results_dir.exists()
@@ -66,9 +67,12 @@ def fake_write_text(_: str) -> None:
6667
# TEST: load
6768
# -------------------------------
6869

69-
def test_load_returns_empty_if_dir_missing(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:
70-
missing_dir: Path = tmp_path / "missing"
71-
settings = Settings(results_dir=missing_dir)
70+
def test_load_returns_empty_if_dir_missing(
71+
caplog: pytest.LogCaptureFixture,
72+
tmp_path: Path,
73+
settings: Settings
74+
) -> None:
75+
settings.results_dir = tmp_path / "missing"
7276
storage = UICoverageTrackerStorage(settings)
7377

7478
result: CoverageResultList = storage.load()

0 commit comments

Comments
 (0)