hub (unreleased): the end-date check reads the certificate's issuer too (the wire gate: a field the box sends must be modelled)

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 18:27:30 +01:00
1 parent 86bb912a4b
commit 0ce752a370
3 files changed
+24 -3

No files matched your search

+6 -1
View File
@@ -66,7 +66,7 @@ func TestEndDates_FourteenDaysOnceThenEndedOnce(t *testing.T) {
}
all := strings.Join(f.events, "\n")
for _, want := range []string{"|operator_token_ends_soon|warning|", "„CC hub token”", tokEnd.Format("2006-01-02"), "401",
"demo-hp|web_cert_ends_soon|warning|", "*.enkisfelhom.hu", certEnd.Format("2006-01-02"), "renewal has FAILED"} {
"demo-hp|web_cert_ends_soon|warning|", "*.enkisfelhom.hu", certEnd.Format("2006-01-02"), "renewal has FAILED", `"issuer":"YR2"`} {
if !strings.Contains(all, want) {
t.Errorf("the events lack %q:\n%s", want, all)
}
@@ -128,6 +128,8 @@ func TestEndDates_TheBoxesWordsAreChecked(t *testing.T) {
{CustomerID: "many", ReportJSON: certReport(many...)},
{CustomerID: "evil", ReportJSON: certReport(cert("second-report.example.hu", soon))}, // a duplicate row of the same household
}
// an issuer name that is not a plain name is dropped, the certificate is still told
f.reps = append(f.reps, BoxCertReport{CustomerID: "iss", ReportJSON: `{"web_certs":[{"domain":"x.example.hu","not_after":"` + soon.UTC().Format(time.RFC3339) + `","issuer":"<i>CA</i>"}]}`})
f.tokens = []EndingToken{{ID: 9, Name: "<b>x</b>", ExpiresAt: soon}}
f.step(0)
all := strings.Join(f.events, "\n")
@@ -140,6 +142,9 @@ func TestEndDates_TheBoxesWordsAreChecked(t *testing.T) {
if n := strings.Count(all, "many|web_cert_ends_soon"); n != webCertsReadMax {
t.Errorf("household „many”: %d event(s), want the cap %d", n, webCertsReadMax)
}
if !strings.Contains(all, "iss|web_cert_ends_soon") || strings.Contains(all, "<i>") || !strings.Contains(all, `"issuer":""`) {
t.Errorf("an issuer that is not a plain name must be dropped and the certificate still told:\n%s", all)
}
if !strings.Contains(all, "„token #9”") {
t.Errorf("a token with a name that is not plain text must be named by its number:\n%s", all)
}