package web import ( "strings" "testing" "gitea.dooplex.hu/admin/felhom-controller/internal/stacks" ) // R-694 (v0.275.0) — a deployed app whose admin login was GENERATED by a restore: the page shows no value // for it and says the old password is the one that works; an app without that record renders as before. // Rendered through the production template path (renderI18nCase), both languages. func TestR694_TheDeployPageDoesNotOfferAGeneratedLogin(t *testing.T) { s := i18nTestServer(t) base := func() map[string]interface{} { return i18nDeployData(true, stacks.StateRunning, 1) } restored := func() map[string]interface{} { d := base() d["DeployedFieldValues"] = map[string]string{"SUBDOMAIN": "paste"} // the handler removed the value d["RestoredLogins"] = map[string]bool{"ADMIN_PASSWORD": true} return d } hu := renderI18nCase(t, s, "hu", i18nCase{"r694", "deploy", restored}) if !strings.Contains(hu, "Mentésből töltötted vissza") || strings.Contains(hu, "rejtett érték") || strings.Contains(hu, "Telepítéskor beállított kezdeti jelszó") { t.Fatalf("hu page does not say to use the old password, or still shows a value") } en := renderI18nCase(t, s, "en", i18nCase{"r694", "deploy", restored}) if !strings.Contains(en, "Restored from a backup: log in with the password that was valid when the backup was taken") { t.Fatal("en page lacks the sentence") } plain := renderI18nCase(t, s, "hu", i18nCase{"r694-plain", "deploy", base}) if strings.Contains(plain, "Mentésből töltötted vissza") || !strings.Contains(plain, "Telepítéskor beállított kezdeti jelszó") { t.Fatal("an app without restored_logins changed") } }