package equipotest import ( "amadan.net/oficina/equipo/internal/equipo" "net/http/httptest" "strings" "testing" ) func TestExpiredConnectionShowsSignInAgain(t *testing.T) { f := connectionStore(t) f.choice(t, f.ids["claude"]) f.reports[0].Available = false f.reports[0].UnavailableReason = "account.sign_in_again" executionMust(t, f.s.ReportConnections(connectionContext, f.principal, f.reports)) f.denied(t, "Engineering", "") mail := &capturingMailer{} h, err := equipo.App(f.d, testConfig(testOrigin), mail, nil) executionMust(t, err) server := httptest.NewServer(h) defer server.Close() client := signinClient(t, server.URL) signinEmail(t, client, server.URL, testOrigin, mail, ownerAddress) res, err := client.Get(server.URL + "/connections") executionMust(t, err) body := readBody(t, res) if res.StatusCode != 200 || !strings.Contains(body, "Sign in again") { t.Fatal("expired connection has no sign-in state", res.StatusCode) } }