R-1278: the install page says when a backup of an earlier install is kept and links the restore page (HU and EN). Red-proved. Commit only.
gates / gates (push) Successful in 1m33s
gates / gates (push) Successful in 1m33s
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// R-1278: a volume app's reinstall said nothing about the backup of the earlier install the box keeps (set aside by
|
||||
// D47, or left by „remove — keep backups"). The install page now says the install starts empty and links the restore
|
||||
// page. One render per branch of the gate (the template-gate rule): kept + not installed → shown; none → not shown;
|
||||
// installed → not shown.
|
||||
// RED-PROOF: delete the {{if .KeptBackups}} block → the first case fails.
|
||||
func TestR1278_TheInstallPageOffersTheKeptBackup(t *testing.T) {
|
||||
shown := renderDeployWithFields(t, false, map[string]interface{}{"KeptBackups": 2})
|
||||
if !strings.Contains(shown, `data-kept-backups="2"`) || !strings.Contains(shown, `href="/backups/restore"`) {
|
||||
t.Fatal("with a kept backup of an earlier install the page must say so and link the restore page")
|
||||
}
|
||||
if strings.Contains(renderDeployWithFields(t, false, map[string]interface{}{"KeptBackups": 0}), "kept-backup-offer") {
|
||||
t.Fatal("no kept backup → no notice")
|
||||
}
|
||||
if strings.Contains(renderDeployWithFields(t, false, map[string]interface{}{"KeptBackups": 1, "AlreadyDeployed": true}), "kept-backup-offer") {
|
||||
t.Fatal("an installed app shows no install-time notice")
|
||||
}
|
||||
}
|
||||
|
||||
// The page reads the count from the backup manager (seam-built-but-never-wired is a recorded class).
|
||||
func TestR1278_TheDeployPageAsksTheBackupManager(t *testing.T) {
|
||||
b, err := os.ReadFile("handlers.go")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(b), `data["KeptBackups"] = s.backupMgr.KeptBackupsFor(name)`) {
|
||||
t.Fatal("deployPageData must set KeptBackups from the backup manager")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user