test: réparer la fuite mock_http → og_fetcher et le marqueur page-templates
- mock_http (test_agent_web_tools) : og_fetcher, importé paresseusement
par url_fetch pendant la fenêtre patchée, figeait la factory mockée
'build' comme shared_client ; son handler répondait ensuite aux
fetch_og_metadata des tests suivants du même worker xdist (flake
test_v55 : « Titre de la page »). La restauration du finally couvre
désormais og_fetcher, comme elle couvrait déjà url_fetch.
- test_editor_front_end_wired : depuis la refonte templates (fc85481),
le câblage page-templates vit dans page_editor_scripts.js (le picker
de base.html passe par le registre unifié /api/templates) ; le
marqueur est vérifié dans le fichier qui le porte, à force égale.
This commit is contained in:
@@ -24,6 +24,7 @@ import contextlib
|
|||||||
import ipaddress
|
import ipaddress
|
||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import pytest
|
import pytest
|
||||||
@@ -108,6 +109,14 @@ def mock_http(handler):
|
|||||||
from app.services.importers import url_fetch
|
from app.services.importers import url_fetch
|
||||||
if getattr(url_fetch, "shared_client", None) is build:
|
if getattr(url_fetch, "shared_client", None) is build:
|
||||||
url_fetch.shared_client = _REAL_SHARED_CLIENT
|
url_fetch.shared_client = _REAL_SHARED_CLIENT
|
||||||
|
# Même fuite via og_fetcher : url_fetch l'importe paresseusement
|
||||||
|
# (parse_og) PENDANT la fenêtre, et son `from … import shared_client`
|
||||||
|
# fige alors `build` — le handler du test courant répondait ensuite
|
||||||
|
# aux fetch_og_metadata des tests suivants du même worker xdist
|
||||||
|
# (flake test_v55 : titre « Titre de la page » au lieu du sien).
|
||||||
|
og_fetcher = sys.modules.get("app.services.og_fetcher")
|
||||||
|
if og_fetcher is not None and getattr(og_fetcher, "shared_client", None) is build:
|
||||||
|
og_fetcher.shared_client = _REAL_SHARED_CLIENT
|
||||||
|
|
||||||
|
|
||||||
def run(coro):
|
def run(coro):
|
||||||
|
|||||||
@@ -396,7 +396,11 @@ def test_editor_front_end_wired(client):
|
|||||||
assert "gtTok" in src and "fd-wiki-chip" in src # chip render + reader
|
assert "gtTok" in src and "fd-wiki-chip" in src # chip render + reader
|
||||||
assert "wiki/pages" in src and "wiki/titles" in src # picker + label resolution
|
assert "wiki/pages" in src and "wiki/titles" in src # picker + label resolution
|
||||||
assert "WM={" in src and "fdpage:" in src # [[ picker module
|
assert "WM={" in src and "fdpage:" in src # [[ picker module
|
||||||
assert "_openTemplatePicker" in base and "page-templates" in base
|
# Depuis la refonte templates (fc85481), le picker de base.html passe par
|
||||||
|
# le registre unifié (/api/templates) ; le câblage « page-templates » vit
|
||||||
|
# dans l'éditeur (fetch /board/api/page-templates) — chaque marqueur est
|
||||||
|
# donc vérifié dans le fichier qui le porte réellement.
|
||||||
|
assert "_openTemplatePicker" in base and "page-templates" in src
|
||||||
assert "toggleLock" in src and "saveAsTemplate" in src
|
assert "toggleLock" in src and "saveAsTemplate" in src
|
||||||
css = pathlib.Path("static/css/app.css").read_text(encoding="utf-8")
|
css = pathlib.Path("static/css/app.css").read_text(encoding="utf-8")
|
||||||
assert ".fd-wiki-chip" in css and ".fd-lock-banner" in css and ".tpl-picker-modal" in css
|
assert ".fd-wiki-chip" in css and ".fd-lock-banner" in css and ".tpl-picker-modal" in css
|
||||||
|
|||||||
Reference in New Issue
Block a user