Files
OpsLog/internal/email/email_explain_test.go
T
rouggy fd7ae77a61 fix(tci): subscribe to the radio's meters; fix the new-spot count; explain an SMTP refusal
TCI meters: the S-meter came only from RX_SMETER and the transmit meters from
TX_POWER / TX_SWR — commands ExpertSDR3 does not send. The protocol's answer is
a subscription (RX_SENSORS_ENABLE / TX_SENSORS_ENABLE, §4.4 of the TCI PDF),
after which the radio pushes RX_CHANNEL_SENSORS and TX_SENSORS. Nobody had
asked, so the console's meters sat empty in RX and in TX while everything else
worked.

Cluster: the held-spot counter looked for the row it froze on. A station spotted
again REPLACES its row, so that row vanishes in the ordinary course of things
and the count fell through to 'everything is new' — 4, 5, then 500. Counted by
timestamp now, which survives both the replacement and the ring buffer.

SMTP: '535 5.7.139 basic authentication is disabled' is a policy, not a typo.
The message now says so, and says what actually helps, without claiming a policy
when the server simply rejected the password.
2026-08-28 15:29:44 +02:00

30 lines
1.0 KiB
Go

package email
import (
"errors"
"strings"
"testing"
)
func TestExplainSMTP(t *testing.T) {
// The real refusal, from an operator's Outlook account.
outlook := errors.New("SMTP AUTH failed: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled.")
if got := explainSMTP(outlook); !strings.Contains(got, "Microsoft has switched off") {
t.Errorf("the Microsoft policy refusal is not explained: %q", got)
}
// A plain wrong password must NOT claim a policy: the advice would send the
// operator to an administrator over a typo.
wrong := errors.New("535 5.7.8 authentication failed")
got := explainSMTP(wrong)
if strings.Contains(got, "Microsoft") {
t.Errorf("a wrong password was explained as a Microsoft policy: %q", got)
}
if !strings.Contains(got, "rejected the username") {
t.Errorf("a wrong password is not explained: %q", got)
}
// Anything else is left to speak for itself.
if got := explainSMTP(errors.New("dial tcp: i/o timeout")); got != "" {
t.Errorf("an unrelated error got an explanation: %q", got)
}
}