SashegDev
|
8939e24e69
|
test(server): add client-facing endpoint tests (20 tests), fix pack contract assertions
- Add test_client.py with comprehensive client-server contract tests:
- TestAuthFlowClient: full register → login → refresh → validate → /admin/me → logout lifecycle
- TestPacksClientContract: /packs response fields matching ServerPack.java
- TestPackManifestClientContract: /pack/{name} fields matching PackManifest.java
- TestPackDiffClientContract: /pack/{name}/diff matching DiffResponse/FileInfo.java
(all-new, no-changes, outdated-file, extra-local-file scenarios)
- TestPackFileDownload: file serving, 404, path traversal security
- TestPackPermissions: auth/pass requirements for /packs and /diff
- TestLauncherVersion: /launcher/version endpoint
- TestProxyEndpoints: /proxy/status, /proxy/fabric/versions/loader
- Add logged_in_user_with_pass fixture (role=1) for pack-related tests
- Add pack_fixture: creates temp pack with mod file, scans it, cleans up
- Fix manifest test: files don't have 'url' field (only in diff response)
- Fix /pack/{name} test: endpoint is public, no auth required
Total: 67 tests passing (47 existing + 20 new)
|
2026-05-04 22:28:12 +00:00 |
|
SashegDev
|
c0310ed573
|
test(server): add comprehensive test suite (47 tests), fix DB lock and schema bugs
- Add pytest test suite: test_auth.py, test_admin.py, test_pass.py,
test_proxy.py, test_rate_limit.py, test_client_contract.py
- Fix SQLite 'database is locked' errors: moved log_audit() calls outside
with get_db() blocks in register, login, logout, refresh, activate_pass
- Enable WAL mode and busy_timeout in get_db() for concurrent access
- Fix /admin/me: removed non-existent 'email' column from query
- Fix /admin/users list: disambiguated activated_at column in JOIN query
- Fix /auth/refresh: now returns refresh_token + expires_in + username/uuid/role
to match AuthManager.AuthSession expectations; revokes old refresh token
- Fix conftest.py: unique usernames per test to avoid conflicts
- All 47 tests passing
|
2026-05-04 22:14:06 +00:00 |
|