fix: correct test assertions and add dependency caching
- Fix logout test to expect {ok: true} instead of {message: ...}
- Fix logout without auth test (endpoint doesn't require auth)
- Fix password change tests to use current_password instead of old_password
- Fix password change error code expectation (400 instead of 401)
- Add Python venv caching to speed up backend tests
- Add Node modules caching to speed up frontend tests
- Cache is keyed by requirements/package-lock file hashes
This commit is contained in:
@@ -195,7 +195,7 @@ class TestLogoutFlow:
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["message"] == "Logged out successfully"
|
||||
assert data["ok"] is True
|
||||
|
||||
def test_logout_clears_cookies(self, test_app, mock_config, temp_auth_file, admin_headers):
|
||||
"""Test that logout clears auth cookies."""
|
||||
@@ -206,10 +206,12 @@ class TestLogoutFlow:
|
||||
# TestClient doesn't fully simulate cookie deletion, but we can check response
|
||||
|
||||
def test_logout_without_auth(self, test_app, mock_config, temp_auth_file):
|
||||
"""Test logout without authentication."""
|
||||
"""Test logout without authentication - should succeed as logout doesn't require auth."""
|
||||
response = test_app.post("/api/auth/logout")
|
||||
|
||||
assert response.status_code == 401
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["ok"] is True
|
||||
|
||||
|
||||
class TestUserInfo:
|
||||
@@ -281,7 +283,7 @@ class TestPasswordChange:
|
||||
"/api/auth/change-password",
|
||||
headers=admin_headers,
|
||||
json={
|
||||
"old_password": old_password,
|
||||
"current_password": old_password,
|
||||
"new_password": new_password
|
||||
}
|
||||
)
|
||||
@@ -298,19 +300,19 @@ class TestPasswordChange:
|
||||
"/api/auth/change-password",
|
||||
headers=admin_headers,
|
||||
json={
|
||||
"old_password": "wrong_password",
|
||||
"current_password": "wrong_password",
|
||||
"new_password": "new_password_123"
|
||||
}
|
||||
)
|
||||
|
||||
assert response.status_code == 401
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_change_password_without_auth(self, test_app, mock_config, temp_auth_file):
|
||||
"""Test password change without authentication."""
|
||||
response = test_app.post(
|
||||
"/api/auth/change-password",
|
||||
json={
|
||||
"old_password": "old",
|
||||
"current_password": "old",
|
||||
"new_password": "new"
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user