test(gateway): repoint slash-command mocks after mixin extraction
Tests for the extracted handlers mocked symbols at gateway.run.*; the handlers now resolve top-level-imported deps (atomic_json_write, fetch_account_usage, render_account_usage_lines) and __file__ from gateway.slash_commands. Repoint those mocks. run.py-resident methods (_increment_restart_failure_counts, _clear_restart_failure_count) keep their gateway.run.atomic_json_write mock — only the moved handlers' mocks change. tests/gateway/ 6415 passed / 0 failed.
This commit is contained in:
parent
619bd78273
commit
de5fe2fa7d
3 changed files with 15 additions and 8 deletions
|
|
@ -86,12 +86,15 @@ class TestHandleUpdateCommand:
|
|||
class FakePath(type(Path())):
|
||||
pass
|
||||
|
||||
# Actually, simplest: just patch the specific file attr
|
||||
fake_file = str(fake_root / "gateway" / "run.py")
|
||||
# Actually, simplest: just patch the specific file attr.
|
||||
# The _handle_update_command handler lives in gateway/slash_commands.py
|
||||
# (extracted from run.py in the god-file decomposition); it resolves
|
||||
# project_root via Path(__file__).parent.parent, so fake that file.
|
||||
fake_file = str(fake_root / "gateway" / "slash_commands.py")
|
||||
(fake_root / "gateway").mkdir(parents=True)
|
||||
(fake_root / "gateway" / "run.py").touch()
|
||||
(fake_root / "gateway" / "slash_commands.py").touch()
|
||||
|
||||
with patch("gateway.run.__file__", fake_file):
|
||||
with patch("gateway.slash_commands.__file__", fake_file):
|
||||
result = await runner._handle_update_command(event)
|
||||
|
||||
assert "Not a git repository" in result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue