generated from xmidt-org/.go-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add options pattern to BasicClient
- client options - get logger - store base url - store api path - http client - store bucket - listener options - set and get logger - pull interval - listeners (called at each pull interval) - allow users to define their own db client instead of using argus
- Loading branch information
Showing
14 changed files
with
863 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-FileCopyrightText: 2025 Comcast Cable Communications Management, LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package auth | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestPrincipal(t *testing.T) { | ||
t.Run("Test SetPartnerIDs, GetPartnerIDs", func(t *testing.T) { | ||
assert := assert.New(t) | ||
partnerIDs := []string{"foo", "bar"} | ||
ctx := SetPartnerIDs(context.Background(), partnerIDs) | ||
actualPartnerIDs, ok := GetPartnerIDs(ctx) | ||
assert.True(ok) | ||
assert.Equal(partnerIDs, actualPartnerIDs) | ||
actualPartnerIDs, ok = GetPartnerIDs(context.Background()) | ||
assert.False(ok) | ||
var empty []string | ||
assert.Equal(empty, actualPartnerIDs) | ||
}) | ||
t.Run("Test SetPrincipal, GetPrincipal", func(t *testing.T) { | ||
assert := assert.New(t) | ||
principal := "foo" | ||
ctx := SetPrincipal(context.Background(), principal) | ||
actualPrincipal, ok := GetPrincipal(ctx) | ||
assert.True(ok) | ||
assert.Equal(principal, actualPrincipal) | ||
actualPrincipal, ok = GetPrincipal(context.Background()) | ||
assert.False(ok) | ||
assert.Equal("", actualPrincipal) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.