(t *testing.T)
| 162 | } |
| 163 | |
| 164 | func TestNewJSONNoEmail(t *testing.T) { |
| 165 | tmpHome := t.TempDir() |
| 166 | |
| 167 | fn := filepath.Join(tmpHome, ConfigFileName) |
| 168 | js := ` { "auths": { "https://index.docker.io/v1/": { "auth": "am9lam9lOmhlbGxv" } } }` |
| 169 | if err := os.WriteFile(fn, []byte(js), 0o600); err != nil { |
| 170 | t.Fatal(err) |
| 171 | } |
| 172 | |
| 173 | config, err := Load(tmpHome) |
| 174 | assert.NilError(t, err) |
| 175 | |
| 176 | ac := config.AuthConfigs["https://index.docker.io/v1/"] |
| 177 | assert.Equal(t, ac.Username, "joejoe") |
| 178 | assert.Equal(t, ac.Password, "hello") |
| 179 | |
| 180 | // Now save it and make sure it shows up in new form |
| 181 | configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) |
| 182 | |
| 183 | expConfStr := `{ |
| 184 | "auths": { |
| 185 | "https://index.docker.io/v1/": { |
| 186 | "auth": "am9lam9lOmhlbGxv" |
| 187 | } |
| 188 | } |
| 189 | }` |
| 190 | |
| 191 | if configStr != expConfStr { |
| 192 | t.Fatalf("Should have save in new form: \n%s\n not \n%s", configStr, expConfStr) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | func TestJSONWithPsFormat(t *testing.T) { |
| 197 | tmpHome := t.TempDir() |
nothing calls this directly
no test coverage detected
searching dependent graphs…