diff --git a/backend_link_test.go b/backend_link_test.go index 6ef40ed..019619c 100644 --- a/backend_link_test.go +++ b/backend_link_test.go @@ -174,7 +174,8 @@ func TestBackendLink(t *testing.T) { token := env.admin(t) admin := adminID(t, token) user := env.seedUser(t, "admin-gone", nil) - if status, body := env.confirmLink(t, freshUserToken(t, user), env.startLink(t, token)); status != http.StatusOK { + code := env.startLink(t, token) // the request first: the sign-in must not predate it + if status, body := env.confirmLink(t, freshUserToken(t, user), code); status != http.StatusOK { t.Fatalf("link = %d %s", status, body) } check := func(want bool, why string) { @@ -196,7 +197,8 @@ func TestBackendLink(t *testing.T) { token := env.admin(t) admin := adminID(t, token) user := env.seedUser(t, "deactivated", nil) - if status, body := env.confirmLink(t, freshUserToken(t, user), env.startLink(t, token)); status != http.StatusOK { + code := env.startLink(t, token) // the request first: the sign-in must not predate it + if status, body := env.confirmLink(t, freshUserToken(t, user), code); status != http.StatusOK { t.Fatalf("link = %d %s", status, body) } spy.reset()