MCPcopy Create free account
hub / github.com/basecamp/hey-cli / TestMultipleOrigins

Function TestMultipleOrigins

internal/auth/store_test.go:74–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestMultipleOrigins(t *testing.T) {
75 s := testStore(t)
76 origins := []string{
77 "https://app.hey.com",
78 "https://staging.hey.com",
79 }
80
81 for i, origin := range origins {
82 tok := "token-" + origin
83 if err := s.Save(origin, &Credentials{AccessToken: tok, OAuthType: "oauth"}); err != nil {
84 t.Fatalf("Save[%d]: %v", i, err)
85 }
86 }
87
88 for i, origin := range origins {
89 creds, err := s.Load(origin)
90 if err != nil {
91 t.Fatalf("Load[%d]: %v", i, err)
92 }
93 want := "token-" + origin
94 if creds.AccessToken != want {
95 t.Errorf("Load[%d] AccessToken = %q, want %q", i, creds.AccessToken, want)
96 }
97 }
98}
99
100func TestFilePermissions(t *testing.T) {
101 s := testStore(t)

Callers

nothing calls this directly

Calls 3

testStoreFunction · 0.85
LoadMethod · 0.80
SaveMethod · 0.45

Tested by

no test coverage detected