aboutsummaryrefslogtreecommitdiff
path: root/clientapi/auth/user_interactive_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'clientapi/auth/user_interactive_test.go')
-rw-r--r--clientapi/auth/user_interactive_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/clientapi/auth/user_interactive_test.go b/clientapi/auth/user_interactive_test.go
index 262e4810..001b1a6d 100644
--- a/clientapi/auth/user_interactive_test.go
+++ b/clientapi/auth/user_interactive_test.go
@@ -187,3 +187,38 @@ func TestUserInteractivePasswordBadLogin(t *testing.T) {
}
}
}
+
+func TestUserInteractive_AddCompletedStage(t *testing.T) {
+ tests := []struct {
+ name string
+ sessionID string
+ }{
+ {
+ name: "first user",
+ sessionID: util.RandomString(8),
+ },
+ {
+ name: "second user",
+ sessionID: util.RandomString(8),
+ },
+ {
+ name: "third user",
+ sessionID: util.RandomString(8),
+ },
+ }
+ u := setup()
+ ctx := context.Background()
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ _, 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, "")
+ })
+ }
+}