Task 7 complete: move config operational orchestration from routers into service/task layer
This commit is contained in:
@@ -10,7 +10,6 @@ import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
import app
|
||||
|
||||
from app.config import Settings
|
||||
from app.db import init_db
|
||||
from app.main import create_app
|
||||
@@ -808,7 +807,7 @@ class TestActivateJail:
|
||||
|
||||
assert resp.status_code == 200
|
||||
# Verify the override values were passed to the service
|
||||
called_req = mock_activate.call_args.args[3]
|
||||
called_req = mock_activate.call_args.args[4]
|
||||
assert called_req.bantime == "1h"
|
||||
assert called_req.maxretry == 3
|
||||
|
||||
@@ -978,11 +977,11 @@ class TestDeactivateJail:
|
||||
)
|
||||
with (
|
||||
patch(
|
||||
"app.routers.config.jail_config_service.deactivate_jail",
|
||||
"app.routers.config.jail_config_service._deactivate_jail",
|
||||
AsyncMock(return_value=mock_response),
|
||||
),
|
||||
patch(
|
||||
"app.routers.config._run_probe",
|
||||
"app.services.jail_config_service.run_probe",
|
||||
AsyncMock(),
|
||||
) as mock_probe,
|
||||
):
|
||||
@@ -2192,7 +2191,7 @@ class TestRollbackEndpoint:
|
||||
message="Jail 'sshd' disabled and fail2ban restarted.",
|
||||
)
|
||||
with patch(
|
||||
"app.routers.config.jail_config_service.rollback_jail",
|
||||
"app.routers.config.jail_config_service._rollback_jail",
|
||||
AsyncMock(return_value=mock_result),
|
||||
):
|
||||
resp = await config_client.post("/api/config/jails/sshd/rollback")
|
||||
@@ -2229,7 +2228,7 @@ class TestRollbackEndpoint:
|
||||
message="fail2ban did not come back online.",
|
||||
)
|
||||
with patch(
|
||||
"app.routers.config.jail_config_service.rollback_jail",
|
||||
"app.routers.config.jail_config_service._rollback_jail",
|
||||
AsyncMock(return_value=mock_result),
|
||||
):
|
||||
resp = await config_client.post("/api/config/jails/sshd/rollback")
|
||||
|
||||
Reference in New Issue
Block a user