Translate the whole site to English: English routes with 301 redirects from the Dutch paths, English UI, docs, seeds and captions, one-time live content migration
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
from molodetz.content import PLACEHOLDER_NOTE, SEED_POSTS
|
||||
|
||||
ROLL_SEEDS = {"A pass is not an ambition.", "Finished is a feature.", "The assistant is not a senior.", "No course."}
|
||||
|
||||
|
||||
def test_seeded_posts_and_placeholders(anon):
|
||||
roll = anon.get("/roll", headers={"Accept": "application/json"}).json()["posts"]
|
||||
assert ROLL_SEEDS <= {post["title"] for post in roll}
|
||||
assert all(post["is_placeholder"] for post in roll if post["title"] in ROLL_SEEDS)
|
||||
assert all(post["topic"] == "roll" for post in roll)
|
||||
standard = anon.get("/standard", headers={"Accept": "application/json"}).json()["posts"]
|
||||
choices = next(post for post in standard if post["title"] == "Thirty-one choices. You have zero.")
|
||||
assert choices["is_placeholder"] is False
|
||||
assert choices["slug"].startswith("thirty-one-choices-you-have-zero-")
|
||||
|
||||
|
||||
def test_seed_texts_are_english_and_keep_placeholder_marker():
|
||||
assert {title for _, title, _ in SEED_POSTS} >= ROLL_SEEDS | {"Thirty-one choices. You have zero."}
|
||||
assert PLACEHOLDER_NOTE.strip().startswith("> Placeholder.")
|
||||
assert "retoor will replace it" in PLACEHOLDER_NOTE
|
||||
for _, title, body in SEED_POSTS:
|
||||
for dutch in (" een ", " het ", " niet ", " geen ", " wie "):
|
||||
assert dutch not in f" {title.lower()} {body.lower()} ", (title, dutch)
|
||||
assert chr(0x2014) not in body and chr(0x2013) not in body
|
||||
|
||||
|
||||
def test_placeholder_note_renders_on_roll_post(anon):
|
||||
roll = anon.get("/roll", headers={"Accept": "application/json"}).json()["posts"]
|
||||
post = next(post for post in roll if post["title"] == "Finished is a feature.")
|
||||
html = anon.get(f"/posts/{post['slug']}").text
|
||||
assert "Carried over from the old Molodetz page" in html
|
||||
assert "A project that stays open is an opinion." in html
|
||||
Reference in New Issue
Block a user