fix(wcd): create sticker assets when reused content is a reference
This commit is contained in:
@@ -90,6 +90,31 @@ def test_stale_sha256_meta_does_not_reuse_mismatched_file(isolated_asset_store):
|
||||
assert len(asset_dirs(isolated_asset_store)) == 2
|
||||
|
||||
|
||||
def test_reference_with_same_content_creates_sticker_asset(isolated_asset_store):
|
||||
content = SVG.encode()
|
||||
existing_id = "asset_reference00000000000000000000000"
|
||||
existing_dir = isolated_asset_store / existing_id[:2] / existing_id
|
||||
existing_dir.mkdir(parents=True)
|
||||
(existing_dir / "asset.svg").write_bytes(content)
|
||||
(existing_dir / "meta.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"asset_id": existing_id,
|
||||
"name": "old",
|
||||
"type": "reference",
|
||||
"mime_type": "image/svg+xml",
|
||||
"sha256": hashlib.sha256(content).hexdigest(),
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
imported = app._register_import_asset("new", content, "image/svg+xml")
|
||||
|
||||
assert imported["asset_id"] != existing_id
|
||||
assert imported["type"] == "sticker"
|
||||
assert len(asset_dirs(isolated_asset_store)) == 2
|
||||
|
||||
|
||||
def test_wcd_production_uses_real_asset_ids(tmp_path, isolated_asset_store, monkeypatch):
|
||||
manifest = {
|
||||
"format": "wordcloud-canvas",
|
||||
|
||||
Reference in New Issue
Block a user