Enhance ImageObject schema with attribution and license metadata in views and tests
All checks were successful
Deploy to Server / deploy (push) Successful in 11s
All checks were successful
Deploy to Server / deploy (push) Successful in 11s
This commit is contained in:
parent
f8236034a3
commit
28cd62b161
2 changed files with 99 additions and 14 deletions
|
|
@ -1730,7 +1730,7 @@ class TestImageObjectStructuredData:
|
|||
org: Organization,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""VideoGame ImageObject should carry creditText and copyrightNotice."""
|
||||
"""VideoGame ImageObject should carry attribution and license metadata."""
|
||||
url: str = reverse("twitch:game_detail", args=[game.twitch_id])
|
||||
response: _MonkeyPatchedWSGIResponse = client.get(url)
|
||||
|
||||
|
|
@ -1738,6 +1738,19 @@ class TestImageObjectStructuredData:
|
|||
img: dict[str, Any] = schema["image"]
|
||||
assert img["creditText"] == org.name
|
||||
assert org.name in img["copyrightNotice"]
|
||||
assert img["creator"] == {
|
||||
"@type": "Organization",
|
||||
"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,
|
||||
|
|
@ -1837,7 +1850,7 @@ class TestImageObjectStructuredData:
|
|||
org: Organization,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Event ImageObject should carry creditText and copyrightNotice."""
|
||||
"""Event ImageObject should carry attribution and license metadata."""
|
||||
url: str = reverse("twitch:campaign_detail", args=[campaign.twitch_id])
|
||||
response: _MonkeyPatchedWSGIResponse = client.get(url)
|
||||
|
||||
|
|
@ -1845,6 +1858,19 @@ class TestImageObjectStructuredData:
|
|||
img: dict[str, Any] = schema["image"]
|
||||
assert img["creditText"] == org.name
|
||||
assert org.name in img["copyrightNotice"]
|
||||
assert img["creator"] == {
|
||||
"@type": "Organization",
|
||||
"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,
|
||||
|
|
@ -1916,6 +1942,13 @@ class TestImageObjectStructuredData:
|
|||
|
||||
schema: dict[str, Any] = json.loads(response.context["schema_data"])
|
||||
assert schema["image"]["creditText"] == "Twitch"
|
||||
assert schema["image"]["creator"] == {
|
||||
"@type": "Organization",
|
||||
"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 ---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue