Files
selfpost/internal/web/handlers/handlers_dmarc_window_test.go
T
mixandClaude Opus 5.5 0eaf69a830 dmarc-day, health-sockets: the reporter's day said; the inbound journal dialled
The owner, 2026-10-17: "Показ времени отчёта по UTC принимаем. Это не
проблема. Пояснения добавь. Все мелочи закрой." Designs 9b33b80, 2bf9056.

DMARC: a report's day stays the reporter's, in UTC (RFC 7489 § 7.2); the
report's Window now says so under its times (windowNote), and Settings'
Time zone box and Help (#settings, #dmarc) name it as the one exception to
the panel's zone. formatDMARCWindow counts a window that ends at midnight
as ending the day before, so a daily report is one day, not "20 Sep - 21
Sep" (TestDMARCWindowIsTheReportersDay, in Moscow's zone).

Health: with the inbound relay on, the inbound journal milter's socket is
dialled (InboundJournalSocket through web and handlers Config), fail-open
as the send log's, and Overview's card counts it; the send log's socket is
named journal-milter, as the mockup names it.

The confirmation link's sign-in state is drawn (confirm-email-signin.html);
the panel already renders it.

guide: /license and /server/components, the DMARC pages' paths and day,
selfpost-backup -o / -i / -version, the Inbound log's retention field,
PANEL_COOKIE_SECURE, the inbound journal's socket, the DMARC exception to
the zone. CHANGELOG [Unreleased].

(The e2e case negative_level1_ratelimit, listed as able to pass falsely,
was fixed on 2026-10-14 - the note was stale.)

go vet + go test (26 packages) and make e2e on the test server for this
tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:38:34 +03:00

27 lines
816 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package handlers
import (
"testing"
"time"
)
// A report's window is its reporter's day or days, in UTC, whatever the
// panel's zone; a window that ends at midnight ends the day before.
func TestDMARCWindowIsTheReportersDay(t *testing.T) {
inZone(t, "Europe/Moscow")
day := func(d, h, m, s int) time.Time { return time.Date(2026, 9, d, h, m, s, 0, time.UTC) }
for _, c := range []struct {
begin, end time.Time
want string
}{
{day(20, 0, 0, 0), day(21, 0, 0, 0), "20 Sep"},
{day(20, 0, 0, 0), day(20, 23, 59, 59), "20 Sep"},
{day(20, 0, 0, 0), day(22, 0, 0, 0), "20 Sep – 21 Sep"},
{day(20, 12, 0, 0), day(21, 12, 0, 0), "20 Sep – 21 Sep"},
} {
if got := formatDMARCWindow(c.begin, c.end); got != c.want {
t.Errorf("%s – %s = %q, want %q", c.begin, c.end, got, c.want)
}
}
}