Fix post-deploy auth issues: best-effort service provisioning, integration test auth, test mock corrections

- api/app.py: email/calendar/files provisioning now best-effort (non-fatal); fixed email_manager.create_email_user call to include domain argument
- tests/integration: added module-level auth sessions to all integration test files; added admin auth to api fixture and _resolve_admin_pass() helper; added TEST_PEER_PASSWORD constant; added password to peer creation calls
- tests/test_peer_provisioning.py: renamed rollback test to reflect new best-effort semantics (email failure no longer causes rollback)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 15:42:03 -04:00
parent 975d05eef3
commit fc3cfc9741
10 changed files with 184 additions and 88 deletions
+17 -5
View File
@@ -37,7 +37,7 @@ import requests
from requests.exceptions import ConnectionError, Timeout
sys.path.insert(0, os.path.dirname(__file__))
from conftest import API_BASE
from conftest import API_BASE, _resolve_admin_pass
# ---------------------------------------------------------------------------
# Constants
@@ -56,20 +56,32 @@ _CAL_PORT_B = 5233 # an alternate safe value used as the "changed" state
# Helpers
# ---------------------------------------------------------------------------
_S = None
@pytest.fixture(scope='module', autouse=True)
def _auth_session():
global _S
_S = requests.Session()
_S.headers['Content-Type'] = 'application/json'
r = _S.post(f"{API_BASE}/api/auth/login",
json={'username': 'admin', 'password': _resolve_admin_pass()})
assert r.status_code == 200, f"Login failed: {{r.text}}"
def get(path, **kw):
return requests.get(f"{API_BASE}{path}", **kw)
return _S.get(f"{API_BASE}{path}", **kw)
def put(path, **kw):
return requests.put(f"{API_BASE}{path}", **kw)
return _S.put(f"{API_BASE}{path}", **kw)
def post(path, **kw):
return requests.post(f"{API_BASE}{path}", **kw)
return _S.post(f"{API_BASE}{path}", **kw)
def delete(path, **kw):
return requests.delete(f"{API_BASE}{path}", **kw)
return _S.delete(f"{API_BASE}{path}", **kw)
def wait_for_healthy(timeout: int = _HEALTH_TIMEOUT) -> bool: