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

Function TestFileStoreGetAll

cli/config/credentials/file_store_test.go:144–180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestFileStoreGetAll(t *testing.T) {
145 s1 := "https://example.com"
146 s2 := "https://example2.example.com"
147 f := &fakeStore{configs: map[string]types.AuthConfig{
148 s1: {
149 Username: "foo@example.com",
150 Auth: "super_secret_token",
151 ServerAddress: "https://example.com",
152 },
153 s2: {
154 Username: "foo@example2.com",
155 Auth: "super_secret_token2",
156 ServerAddress: "https://example2.example.com",
157 },
158 }}
159
160 s := NewFileStore(f)
161 as, err := s.GetAll()
162 if err != nil {
163 t.Fatal(err)
164 }
165 if len(as) != 2 {
166 t.Fatalf("wanted 2, got %d", len(as))
167 }
168 if as[s1].Auth != "super_secret_token" {
169 t.Fatalf("expected auth `super_secret_token`, got %s", as[s1].Auth)
170 }
171 if as[s1].Username != "foo@example.com" {
172 t.Fatalf("expected username `foo@example.com`, got %s", as[s1].Username)
173 }
174 if as[s2].Auth != "super_secret_token2" {
175 t.Fatalf("expected auth `super_secret_token2`, got %s", as[s2].Auth)
176 }
177 if as[s2].Username != "foo@example2.com" {
178 t.Fatalf("expected username `foo@example2.com`, got %s", as[s2].Username)
179 }
180}
181
182func TestFileStoreErase(t *testing.T) {
183 f := &fakeStore{configs: map[string]types.AuthConfig{

Callers

nothing calls this directly

Calls 2

NewFileStoreFunction · 0.85
GetAllMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…