Skip to content

Commit

Permalink
adding a stubbed test
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcinil committed Jan 18, 2020
1 parent 475c4ca commit d060265
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions auth/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,30 @@ func TestAuthDisable(t *testing.T) {
}
}

func TestAuthStatus(t *testing.T) {
as, tearDown := setupAuthStore(t)
defer tearDown(t)

// enable authentication to test the first possible condition
as.AuthEnable()

status := as.AuthStatus()
ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(2)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
_, _ = as.Authenticate(ctx, "foo", "bar")
if status != true {
t.Errorf("expected %v, got %v", true, false)
}

// Disabling disabled auth to test the other condition that can be return
as.AuthDisable()

status = as.AuthStatus()
_, _ = as.Authenticate(ctx, "foo", "bar")
if status != false {
t.Errorf("expected %v, got %v", false, true)
}
}

// TestAuthRevisionRace ensures that access to authStore.revision is thread-safe.
func TestAuthInfoFromCtxRace(t *testing.T) {
b, tPath := backend.NewDefaultTmpBackend()
Expand Down

0 comments on commit d060265

Please sign in to comment.