Fix catalog redirects pointing at the old /ruoat
Adding, editing or deleting a dish redirected to /ruoat, which stopped existing when the tab was renamed to Ruuat. Every one of those actions ended on a 404. Shipped in v20260905-4. The rename was done with a scripted replace across views.templ, main.go and the smoke script; handlers.go was not in the list. The tests did not catch it because they asserted only that the response was a 303. A redirect to a dead URL is still a 303. They now assert the target.
This commit is contained in:
+14
-9
@@ -220,9 +220,12 @@ check "the quick-added dish is on the board" \
|
||||
|
||||
# ---- catalog CRUD from the UI -------------------------------------------
|
||||
|
||||
check "adding a main redirects" \
|
||||
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \
|
||||
-d 'nimi=uunikala&kategoria=fish&lisukkeita=1' "http://$addr/ruuat/paaruoka")" "303"
|
||||
# Assert where it redirects, not just that it does: these pointed at the old
|
||||
# /ruoat spelling for a while and every 303-only check was happy.
|
||||
check "adding a main redirects back to the catalog" \
|
||||
"$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
|
||||
-d 'nimi=uunikala&kategoria=fish&lisukkeita=1' "http://$addr/ruuat/paaruoka")" \
|
||||
"/ruuat"
|
||||
|
||||
catalog=$(curl -s -u ":$pass" "http://$addr/ruuat")
|
||||
check "the new main is listed, sentence-cased" "$catalog" "Uunikala"
|
||||
@@ -239,9 +242,10 @@ check "a nameless dish is refused" \
|
||||
"$(curl -s -u ":$pass" -d 'nimi=+++&kategoria=fish' "http://$addr/ruuat/paaruoka")" \
|
||||
"Anna nimi."
|
||||
|
||||
check "adding a side redirects" \
|
||||
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \
|
||||
-d 'nimi=lohkoperunat' "http://$addr/ruuat/lisuke")" "303"
|
||||
check "adding a side redirects back to the catalog" \
|
||||
"$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
|
||||
-d 'nimi=lohkoperunat' "http://$addr/ruuat/lisuke")" \
|
||||
"/ruuat"
|
||||
|
||||
check "the new side is listed" \
|
||||
"$(curl -s -u ":$pass" "http://$addr/ruuat")" "Lohkoperunat"
|
||||
@@ -264,9 +268,10 @@ check "the bin asks before deleting" \
|
||||
check "the dish is still there while it asks" \
|
||||
"$(curl -s -u ":$pass" "http://$addr/ruuat?poista=$uusi&tyyppi=paa")" "Uunikala"
|
||||
|
||||
check "confirming the delete redirects" \
|
||||
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \
|
||||
-d "id=$uusi&tyyppi=paa" "http://$addr/ruuat/poista")" "303"
|
||||
check "confirming the delete redirects back to the catalog" \
|
||||
"$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
|
||||
-d "id=$uusi&tyyppi=paa" "http://$addr/ruuat/poista")" \
|
||||
"/ruuat"
|
||||
|
||||
refute "the dish is gone once confirmed" \
|
||||
"$(curl -s -u ":$pass" "http://$addr/ruuat")" "Uunikala"
|
||||
|
||||
Reference in New Issue
Block a user