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:
+10
-10
@@ -3,7 +3,7 @@ JSON = {"Accept": "application/json"}
|
||||
|
||||
|
||||
def _create(admin, **overrides):
|
||||
payload = {"title": "Een echte notitie", "body": "Tekst met **nadruk** en `code`.", "topic": "rol", "status": "draft"}
|
||||
payload = {"title": "A real note", "body": "Text with **emphasis** and `code`.", "topic": "roll", "status": "draft"}
|
||||
payload.update(overrides)
|
||||
response = admin.post("/admin/posts", json=payload, headers=JSON)
|
||||
assert response.status_code == 200, response.text
|
||||
@@ -11,24 +11,24 @@ def _create(admin, **overrides):
|
||||
|
||||
|
||||
def test_create_draft_is_hidden_then_published(admin, anon):
|
||||
data = _create(admin, title="Concept dat later live gaat")
|
||||
data = _create(admin, title="Draft that goes live later")
|
||||
assert anon.get(f"/posts/{data['slug']}").status_code == 404
|
||||
assert admin.post(f"/admin/posts/{data['uid']}/publish", headers=JSON).status_code == 200
|
||||
page = anon.get(f"/posts/{data['slug']}")
|
||||
assert page.status_code == 200
|
||||
assert "<strong>nadruk</strong>" in page.text
|
||||
assert "<strong>emphasis</strong>" in page.text
|
||||
|
||||
|
||||
def test_edit_post(admin, anon):
|
||||
data = _create(admin, title="Te bewerken notitie", status="published")
|
||||
response = admin.post(f"/admin/posts/{data['uid']}", json={"title": "Bewerkte notitie", "body": "Nieuwe tekst hier.", "topic": "standaard", "status": "published"}, headers=JSON)
|
||||
data = _create(admin, title="Note to edit", status="published")
|
||||
response = admin.post(f"/admin/posts/{data['uid']}", json={"title": "Edited note", "body": "New text right here.", "topic": "standard", "status": "published"}, headers=JSON)
|
||||
assert response.status_code == 200, response.text
|
||||
posts = anon.get("/standaard", headers=JSON).json()["posts"]
|
||||
assert any(post["title"] == "Bewerkte notitie" for post in posts)
|
||||
posts = anon.get("/standard", headers=JSON).json()["posts"]
|
||||
assert any(post["title"] == "Edited note" for post in posts)
|
||||
|
||||
|
||||
def test_delete_goes_to_trash(admin, anon):
|
||||
data = _create(admin, title="Weg ermee notitie", status="published")
|
||||
data = _create(admin, title="Gone with it note", status="published")
|
||||
assert admin.post(f"/admin/posts/{data['uid']}/delete", headers=JSON).status_code == 200
|
||||
assert anon.get(f"/posts/{data['slug']}").status_code == 404
|
||||
trash = admin.get("/admin/trash", headers=JSON).json()["items"]
|
||||
@@ -41,10 +41,10 @@ def test_validation_error(admin):
|
||||
|
||||
|
||||
def test_html_form_post(admin):
|
||||
response = admin.post("/admin/posts", data={"title": "Via formulier", "body": "Formuliertekst hier.", "topic": "rol", "status": "draft"})
|
||||
response = admin.post("/admin/posts", data={"title": "Via the form", "body": "Form text right here.", "topic": "roll", "status": "draft"})
|
||||
assert response.status_code in (302, 303)
|
||||
|
||||
|
||||
def test_member_cannot_write(member):
|
||||
response = member.post("/admin/posts", json={"title": "Niet toegestaan", "body": "Tekst hier.", "topic": "rol"}, headers=JSON)
|
||||
response = member.post("/admin/posts", json={"title": "Not allowed", "body": "Text right here.", "topic": "roll"}, headers=JSON)
|
||||
assert response.status_code == 403
|
||||
|
||||
Reference in New Issue
Block a user