Changement du refresh handler, soft reset d'ajouter sur beaucoup de formulaire de modification
CI - Security, Lint & Tests / validate (push) Failing after 1m3s
CI - Security, Lint & Tests / validate (push) Failing after 1m3s
This commit is contained in:
@@ -59,4 +59,4 @@ class TestAppSettingsBool:
|
||||
AppSettings.set_bool('bool_key', True)
|
||||
assert AppSettings.get('bool_key') == 'true'
|
||||
AppSettings.set_bool('bool_key', False)
|
||||
assert AppSettings.get('bool_key') == 'false'
|
||||
assert AppSettings.get('bool_key') == 'false'
|
||||
|
||||
@@ -58,4 +58,4 @@ class TestAuditLogRecord:
|
||||
|
||||
entry = AuditLog.query.filter_by(action='before_delete').first()
|
||||
assert entry is not None
|
||||
assert entry.user_id is None # FK set to NULL on delete
|
||||
assert entry.user_id is None # FK set to NULL on delete
|
||||
|
||||
@@ -41,7 +41,9 @@ class TestBackupCreate:
|
||||
|
||||
as_role('admin')
|
||||
response = client.post(
|
||||
'/admin/backup/create', data={'notes': 'test backup'}, follow_redirects=False,
|
||||
'/admin/backup/create',
|
||||
data={'notes': 'test backup'},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert _redirected(response)
|
||||
|
||||
@@ -61,7 +63,9 @@ class TestBackupCreate:
|
||||
|
||||
as_role('admin')
|
||||
response = client.post(
|
||||
'/admin/backup/create', data={}, follow_redirects=True,
|
||||
'/admin/backup/create',
|
||||
data={},
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'Backup failed' in html
|
||||
@@ -135,7 +139,8 @@ class TestBackupDownload:
|
||||
record_id = record.id
|
||||
|
||||
response = client.get(
|
||||
f'/admin/backup/{record_id}/download', follow_redirects=True,
|
||||
f'/admin/backup/{record_id}/download',
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'missing from disk' in html.lower()
|
||||
@@ -162,7 +167,8 @@ class TestBackupDelete:
|
||||
record_id = record.id
|
||||
|
||||
response = client.post(
|
||||
f'/admin/backup/{record_id}/delete', follow_redirects=False,
|
||||
f'/admin/backup/{record_id}/delete',
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert _redirected(response)
|
||||
|
||||
@@ -214,14 +220,13 @@ class TestBackupRestore:
|
||||
record_id = record.id
|
||||
|
||||
response = client.post(
|
||||
f'/admin/backup/{record_id}/restore', follow_redirects=True,
|
||||
f'/admin/backup/{record_id}/restore',
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'missing from disk' in html.lower()
|
||||
|
||||
def test_restore_creates_safety_backup_first(
|
||||
self, app, client, as_role, monkeypatch, tmp_path
|
||||
):
|
||||
def test_restore_creates_safety_backup_first(self, app, client, as_role, monkeypatch, tmp_path):
|
||||
import app.routes.admin as admin_module
|
||||
|
||||
# The restore route parses DATABASE_URL outside its try block.
|
||||
@@ -282,4 +287,4 @@ class TestBackupRestore:
|
||||
with app.app_context():
|
||||
safety = BackupRecord.query.filter_by(filename='db_backup_safety.dump').first()
|
||||
assert safety is not None
|
||||
assert safety.backup_type == 'pre_restore'
|
||||
assert safety.backup_type == 'pre_restore'
|
||||
|
||||
@@ -53,4 +53,4 @@ class TestAdminCsrfProtection:
|
||||
# Flask-WTF returns 400 on missing CSRF token
|
||||
assert response.status_code in (400, 302), (
|
||||
f'{route} returned {response.status_code} without CSRF token'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -147,4 +147,4 @@ class TestAdminTemplateIntegrity:
|
||||
def test_static_js_loads(self, client):
|
||||
response = client.get('/static/js/main.js')
|
||||
assert response.status_code == 200
|
||||
assert 'javascript' in response.content_type or 'text/' in response.content_type
|
||||
assert 'javascript' in response.content_type or 'text/' in response.content_type
|
||||
|
||||
@@ -47,4 +47,4 @@ class TestAdminRouteRegistration:
|
||||
return
|
||||
assert _redirected(response), (
|
||||
f'{route} answered {response.status_code} to an anonymous caller'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -154,7 +154,9 @@ class TestSeasonGateEnforcement:
|
||||
|
||||
as_role(role)
|
||||
response = client.post(
|
||||
f'/team-matches/{match_id}/delete', data={}, follow_redirects=True,
|
||||
f'/team-matches/{match_id}/delete',
|
||||
data={},
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'season is not active' in html.lower() or 'begin a season' in html.lower()
|
||||
@@ -167,4 +169,4 @@ class TestSeasonGateEnforcement:
|
||||
data={'title': 'Admin Match', 'date': '2026-10-01', 'start_time': '10:00'},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert _redirected(response) # success, not blocked
|
||||
assert _redirected(response) # success, not blocked
|
||||
|
||||
@@ -84,4 +84,4 @@ class TestAdminImages:
|
||||
def test_esports_logo_image_loads(self, client):
|
||||
# The original logo may still be referenced
|
||||
response = client.get('/static/images/UdeS_logo.png')
|
||||
assert response.status_code == 200
|
||||
assert response.status_code == 200
|
||||
|
||||
@@ -76,9 +76,7 @@ class TestTryoutGateEnforcement:
|
||||
assert 'closed' in html.lower() or 'open tryouts' in html.lower()
|
||||
|
||||
@pytest.mark.parametrize('role', NON_ADMIN_ROLES)
|
||||
def test_non_admin_cannot_edit_tryout_when_closed(
|
||||
self, app, client, as_role, make_user, role
|
||||
):
|
||||
def test_non_admin_cannot_edit_tryout_when_closed(self, app, client, as_role, make_user, role):
|
||||
# Create a tryout as admin first
|
||||
as_role('admin')
|
||||
client.post(
|
||||
@@ -119,7 +117,9 @@ class TestTryoutGateEnforcement:
|
||||
|
||||
as_role(role)
|
||||
response = client.post(
|
||||
f'/tryouts/{tryout_id}/delete', data={}, follow_redirects=True,
|
||||
f'/tryouts/{tryout_id}/delete',
|
||||
data={},
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'closed' in html.lower() or 'open tryouts' in html.lower()
|
||||
@@ -153,4 +153,4 @@ class TestTryoutGateEnforcement:
|
||||
data={'title': 'Admin Edited', 'game': 'Valorant', 'date': '2026-12-01'},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert _redirected(response) # success, not blocked
|
||||
assert _redirected(response) # success, not blocked
|
||||
|
||||
@@ -9,7 +9,12 @@ import pytest
|
||||
|
||||
from app.extensions import db
|
||||
from app.models import (
|
||||
AuditLog, BackupRecord, OrgTeam, TeamMatch, TeamMatchParticipant, TeamPlayer,
|
||||
AuditLog,
|
||||
BackupRecord,
|
||||
OrgTeam,
|
||||
TeamMatch,
|
||||
TeamMatchParticipant,
|
||||
TeamPlayer,
|
||||
)
|
||||
|
||||
|
||||
@@ -21,7 +26,9 @@ class TestWipeConfirmation:
|
||||
def test_wipe_without_confirmation_fails(self, app, client, as_role):
|
||||
as_role('admin')
|
||||
response = client.post(
|
||||
'/admin/teams/wipe', data={}, follow_redirects=True,
|
||||
'/admin/teams/wipe',
|
||||
data={},
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'WIPE' in html
|
||||
@@ -29,7 +36,9 @@ class TestWipeConfirmation:
|
||||
def test_wipe_with_wrong_confirmation_fails(self, app, client, as_role):
|
||||
as_role('admin')
|
||||
response = client.post(
|
||||
'/admin/teams/wipe', data={'confirm': 'yes'}, follow_redirects=True,
|
||||
'/admin/teams/wipe',
|
||||
data={'confirm': 'yes'},
|
||||
follow_redirects=True,
|
||||
)
|
||||
html = response.data.decode()
|
||||
assert 'WIPE' in html
|
||||
@@ -116,4 +125,4 @@ class TestWipeDataRemoval:
|
||||
|
||||
with app.app_context():
|
||||
entry = AuditLog.query.filter_by(action='teams_wiped').first()
|
||||
assert entry is not None
|
||||
assert entry is not None
|
||||
|
||||
Reference in New Issue
Block a user