MCPcopy Create free account
hub / github.com/docker/cli / TestNativeStoreAddCredentials

Function TestNativeStoreAddCredentials

cli/config/credentials/native_store_test.go:93–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestNativeStoreAddCredentials(t *testing.T) {
94 f := &fakeStore{configs: map[string]types.AuthConfig{}}
95 s := &nativeStore{
96 programFunc: mockCommandFn,
97 fileStore: NewFileStore(f),
98 }
99 auth := types.AuthConfig{
100 Username: "foo",
101 Password: "bar",
102 ServerAddress: validServerAddress,
103 }
104 err := s.Store(auth)
105 assert.NilError(t, err)
106 assert.Check(t, is.Len(f.GetAuthConfigs(), 1))
107
108 actual, ok := f.GetAuthConfigs()[validServerAddress]
109 assert.Check(t, ok)
110 expected := types.AuthConfig{
111 ServerAddress: auth.ServerAddress,
112 }
113 assert.Check(t, is.DeepEqual(expected, actual))
114}
115
116func TestNativeStoreAddInvalidCredentials(t *testing.T) {
117 f := &fakeStore{configs: map[string]types.AuthConfig{}}

Callers

nothing calls this directly

Calls 4

StoreMethod · 0.95
GetAuthConfigsMethod · 0.95
NewFileStoreFunction · 0.85
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…