mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 01:35:36 -04:00
test: pilot core database stub helper (#3685)
This commit is contained in:
committed by
GitHub
parent
b1af29c7bc
commit
a22c0fa85e
@@ -4,6 +4,7 @@ from types import ModuleType, SimpleNamespace
|
||||
import pytest
|
||||
|
||||
from tests.helpers.cli_loader import load_script
|
||||
from tests.helpers.db_stubs import make_core_db_stub
|
||||
|
||||
|
||||
class _Conn:
|
||||
@@ -37,14 +38,13 @@ def _load_mail_cli(monkeypatch):
|
||||
pollers = ModuleType("routes.email_pollers")
|
||||
pollers._scheduled_poll_once = lambda: {}
|
||||
pollers._run_auto_summarize_once = lambda **kwargs: ""
|
||||
core_mod = ModuleType("core")
|
||||
database_mod = ModuleType("core.database")
|
||||
database_mod.SessionLocal = object
|
||||
database_mod.EmailAccount = object
|
||||
monkeypatch.setitem(sys.modules, "routes.email_helpers", helpers)
|
||||
monkeypatch.setitem(sys.modules, "routes.email_pollers", pollers)
|
||||
monkeypatch.setitem(sys.modules, "core", core_mod)
|
||||
monkeypatch.setitem(sys.modules, "core.database", database_mod)
|
||||
make_core_db_stub(
|
||||
monkeypatch,
|
||||
attributes={"SessionLocal": object, "EmailAccount": object},
|
||||
install_core_package=True,
|
||||
)
|
||||
return load_script("odysseus-mail")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user