Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diversemix committed Oct 19, 2023
1 parent fcfb586 commit 2830ab4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions unit_tests/mocks/services/config_service.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pytest import MonkeyPatch
from app.errors import RepositoryError

from app.model.config import ConfigReadDTO
from app.model.config import ConfigReadDTO, DocumentConfig, EventConfig


def mock_config_service(config_service, monkeypatch: MonkeyPatch, mocker):
Expand All @@ -13,7 +13,13 @@ def maybe_throw():

def mock_get_config() -> ConfigReadDTO:
maybe_throw()
return ConfigReadDTO(geographies=[], taxonomies={}, languages={})
return ConfigReadDTO(
geographies=[],
taxonomies={},
languages={},
document=DocumentConfig(roles=[], types=[], variants=[]),
event=EventConfig(types=[]),
)

monkeypatch.setattr(config_service, "get", mock_get_config)
mocker.spy(config_service, "get")
2 changes: 2 additions & 0 deletions unit_tests/routers/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def test_get_when_ok(client: TestClient, user_header_token, config_service_mock)
assert "geographies" in keys
assert "taxonomies" in keys
assert "languages" in keys
assert "event" in keys
assert "document" in keys
assert config_service_mock.get.call_count == 1


Expand Down

0 comments on commit 2830ab4

Please sign in to comment.