v0.342.0 (unreleased): the upload watch reads the host's weekly line test (GET /host/line-test, agent >= 0.164.0); qBittorrent's limit = 50 % of the TESTED line only (D41), the watch uses the higher of test and push floor, the system page names the source; red-proved
gates / gates (push) Successful in 1m15s

This commit is contained in:
2026-10-24 08:59:57 +02:00
parent 60e487db51
commit ed1011b088
19 changed files with 300 additions and 19 deletions
@@ -53,3 +53,28 @@ func TestUpwatch_QBLimitLineOnQBittorrentsPageOnly(t *testing.T) {
t.Fatal("no view wired, yet a line")
}
}
// The system page's upload line names its source: the weekly test („heti sebességméréssel") or the off-site push's floor
// („legalább … az éjszakai távoli mentésből"), in the reader's language.
// RED-PROOF: drop `data["UplinkTested"]` in systemPageData → the tested case reads „legalább" → fails.
func TestUpwatch_SystemPageNamesTheLinesSource(t *testing.T) {
s, _ := credsHarness(t)
s.loadTemplates()
render := func(lang string) string {
rr := httptest.NewRecorder()
s.settingsHandler(rr, httptest.NewRequest("GET", "/settings?lang="+lang, nil))
return asciiFold(html.UnescapeString(rr.Body.String()))
}
view := upwatch.View{LineMbps: 90.7, LineKnown: true, LineTested: true}
s.SetUpwatchView(func() upwatch.View { return view })
if hu := render("hu"); !strings.Contains(hu, "heti sebessegmeressel") || strings.Contains(hu, "legalabb <span") {
t.Fatal("tested line: the Hungarian system page does not say „heti sebességméréssel\"")
}
if en := render("en"); !strings.Contains(en, "Mbit/s (measured weekly)") {
t.Fatal("tested line: the English system page does not say „measured weekly\"")
}
view = upwatch.View{LineMbps: 10, LineKnown: true}
if hu := render("hu"); !strings.Contains(hu, "legalabb") || !strings.Contains(hu, "ejszakai tavoli mentesbol") || strings.Contains(hu, "heti sebessegmeressel") {
t.Fatal("push floor: the Hungarian system page does not say „legalább … az éjszakai távoli mentésből\"")
}
}