Refactor ImageObject schema to remove license metadata
This commit is contained in:
parent
28cd62b161
commit
f04d88e8fd
2 changed files with 4 additions and 23 deletions
|
|
@ -1730,7 +1730,7 @@ class TestImageObjectStructuredData:
|
|||
org: Organization,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""VideoGame ImageObject should carry attribution and license metadata."""
|
||||
"""VideoGame ImageObject should carry attribution metadata."""
|
||||
url: str = reverse("twitch:game_detail", args=[game.twitch_id])
|
||||
response: _MonkeyPatchedWSGIResponse = client.get(url)
|
||||
|
||||
|
|
@ -1743,14 +1743,6 @@ class TestImageObjectStructuredData:
|
|||
"name": org.name,
|
||||
"url": f"http://testserver{reverse('twitch:organization_detail', args=[org.twitch_id])}",
|
||||
}
|
||||
assert (
|
||||
img["license"]
|
||||
== f"http://testserver{reverse('twitch:organization_detail', args=[org.twitch_id])}"
|
||||
)
|
||||
assert (
|
||||
img["acquireLicensePage"]
|
||||
== f"http://testserver{reverse('twitch:organization_detail', args=[org.twitch_id])}"
|
||||
)
|
||||
|
||||
def test_game_schema_no_image_when_no_box_art(
|
||||
self,
|
||||
|
|
@ -1850,7 +1842,7 @@ class TestImageObjectStructuredData:
|
|||
org: Organization,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Event ImageObject should carry attribution and license metadata."""
|
||||
"""Event ImageObject should carry attribution metadata."""
|
||||
url: str = reverse("twitch:campaign_detail", args=[campaign.twitch_id])
|
||||
response: _MonkeyPatchedWSGIResponse = client.get(url)
|
||||
|
||||
|
|
@ -1863,14 +1855,6 @@ class TestImageObjectStructuredData:
|
|||
"name": org.name,
|
||||
"url": f"http://testserver{reverse('twitch:organization_detail', args=[org.twitch_id])}",
|
||||
}
|
||||
assert (
|
||||
img["license"]
|
||||
== f"http://testserver{reverse('twitch:organization_detail', args=[org.twitch_id])}"
|
||||
)
|
||||
assert (
|
||||
img["acquireLicensePage"]
|
||||
== f"http://testserver{reverse('twitch:organization_detail', args=[org.twitch_id])}"
|
||||
)
|
||||
|
||||
def test_campaign_schema_no_image_when_no_image_url(
|
||||
self,
|
||||
|
|
@ -1947,8 +1931,6 @@ class TestImageObjectStructuredData:
|
|||
"name": "Twitch",
|
||||
"url": "https://www.twitch.tv/",
|
||||
}
|
||||
assert schema["image"]["license"] == "https://www.twitch.tv/"
|
||||
assert schema["image"]["acquireLicensePage"] == "https://www.twitch.tv/"
|
||||
assert "organizer" not in schema
|
||||
|
||||
# --- _pick_owner / Twitch Gaming skipping ---
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ def _build_image_object(
|
|||
*,
|
||||
copyright_notice: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Build a Schema.org ImageObject with attribution and license metadata.
|
||||
"""Build a Schema.org ImageObject with attribution metadata.
|
||||
|
||||
Args:
|
||||
request: The HTTP request used for absolute URL building.
|
||||
|
|
@ -96,14 +96,13 @@ def _build_image_object(
|
|||
"name": creator_name,
|
||||
"url": creator_url,
|
||||
}
|
||||
|
||||
return {
|
||||
"@type": "ImageObject",
|
||||
"contentUrl": request.build_absolute_uri(image_url),
|
||||
"creditText": creator_name,
|
||||
"copyrightNotice": copyright_notice or creator_name,
|
||||
"creator": creator,
|
||||
"license": creator_url,
|
||||
"acquireLicensePage": creator_url,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue