Skip to content

Commit c50b172

Browse files
committed
test(dataset): make dist_asset tests independent of webpack artifacts
The nested-asset regression tests fetched real TinyMCE files under dist/, which is git-ignored (webpack build output) and not compiled in CI, so they 404'd and broke the pipeline. Rewrite them to monkeypatch _DATASET_ASSETS_DIR to a tmp_path with a probe tree, so they exercise the route's nested-path handling and MIME pinning without depending on build artifacts.
1 parent 073d3b6 commit c50b172

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

app/features/dataset/tests/test_integration.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,18 +416,32 @@ def test_new_version_validation_error_returns_400(test_client):
416416
test_client.get("/logout", follow_redirects=True)
417417

418418

419-
# --- Compiled asset serving (nested TinyMCE files) -----------------------
419+
# --- Compiled asset serving (nested paths) -------------------------------
420+
# dist/ holds webpack build artifacts (git-ignored, not built in CI), so these
421+
# probe the route with a temporary nested tree instead of the real TinyMCE files.
420422

421423

422-
def test_dist_asset_serves_nested_tinymce_model(test_client):
423-
# splent's BaseBlueprint asset route 404s on nested paths; dist_asset must
424-
# serve them so the TinyMCE description editor can load (base_url /dataset/dist).
424+
def test_dist_asset_serves_nested_js(test_client, tmp_path, monkeypatch):
425+
# BaseBlueprint's single-segment asset route 404s on nested paths; dist_asset
426+
# must serve them so the TinyMCE editor loads from base_url /dataset/dist.
427+
nested = tmp_path / "dist" / "models" / "dom"
428+
nested.mkdir(parents=True)
429+
(nested / "model.js").write_text("// probe")
430+
monkeypatch.setattr(dataset_routes, "_DATASET_ASSETS_DIR", str(tmp_path))
431+
425432
response = test_client.get("/dataset/dist/models/dom/model.js")
433+
426434
assert response.status_code == 200
427435
assert "javascript" in response.headers["Content-Type"]
428436

429437

430-
def test_dist_asset_serves_nested_skin_css(test_client):
438+
def test_dist_asset_pins_css_mimetype(test_client, tmp_path, monkeypatch):
439+
nested = tmp_path / "dist" / "skins" / "ui" / "oxide"
440+
nested.mkdir(parents=True)
441+
(nested / "skin.min.css").write_text("body{}")
442+
monkeypatch.setattr(dataset_routes, "_DATASET_ASSETS_DIR", str(tmp_path))
443+
431444
response = test_client.get("/dataset/dist/skins/ui/oxide/skin.min.css")
445+
432446
assert response.status_code == 200
433447
assert "text/css" in response.headers["Content-Type"]

0 commit comments

Comments
 (0)