Update test to correctly check the expected response

This commit is contained in:
Till Faelligen 2022-05-20 09:43:50 +02:00
parent 7fffef562f
commit 3be8262374

View file

@ -207,10 +207,16 @@ func TestUserInteractive_AddCompletedStage(t *testing.T) {
},
}
u := setup()
ctx := context.Background()
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if len(u.Sessions[tt.sessionID]) > 0 {
t.Fatalf("expected 0 completed stages, got %d", len(u.Sessions[tt.sessionID]))
_, resp := u.Verify(ctx, []byte("{}"), nil)
challenge, ok := resp.JSON.(Challenge)
if !ok {
t.Fatalf("expected a Challenge, got %T", resp.JSON)
}
if len(challenge.Completed) > 0 {
t.Fatalf("expected 0 completed stages, got %d", len(challenge.Completed))
}
u.AddCompletedStage(tt.sessionID, "")
})