@@ -55,7 +55,7 @@ def test_newer_post_links_to_the_next_older_post(app_server):
|
||||
assert r.json()["next_post_url"] == f"/posts/{older['slug']}"
|
||||
|
||||
html = requests.get(f"{BASE_URL}/posts/{newer['slug']}")
|
||||
assert f'href="/posts/{older["slug"]}" class="back-link next-post-link"' in html.text
|
||||
assert f'href="/posts/{older["slug"]}" class="next-post-link"' in html.text
|
||||
assert f'<link rel="next" href="{BASE_URL}/posts/{older["slug"]}">' in html.text
|
||||
|
||||
|
||||
@@ -69,4 +69,4 @@ def test_next_post_link_is_absent_when_the_url_is_none(app_server):
|
||||
assert "next-post-link" not in html
|
||||
assert 'rel="next"' not in html
|
||||
else:
|
||||
assert f'href="{data["next_post_url"]}" class="back-link next-post-link"' in html
|
||||
assert f'href="{data["next_post_url"]}" class="next-post-link"' in html
|
||||
|
||||
@@ -245,7 +245,11 @@ def test_post_schema_has_date_modified(page, app_server):
|
||||
assert "dateModified" in text
|
||||
|
||||
|
||||
def test_post_detail_has_no_rel_next(page, app_server):
|
||||
def test_post_detail_rel_next_points_at_an_older_post(page, app_server):
|
||||
slug, _ = _seed_post_seo()
|
||||
page.goto(f"{BASE_URL}/posts/{slug}", wait_until="domcontentloaded")
|
||||
assert page.locator('link[rel="next"]').count() == 0
|
||||
link = page.locator('link[rel="next"]')
|
||||
if link.count() == 0:
|
||||
return
|
||||
assert "/posts/" in link.get_attribute("href")
|
||||
assert page.locator(".next-post-link").count() == 1
|
||||
|
||||
Reference in New Issue
Block a user