| 292 | } |
| 293 | |
| 294 | func TestConfigDir(t *testing.T) { |
| 295 | tmpHome := t.TempDir() |
| 296 | |
| 297 | if Dir() == tmpHome { |
| 298 | t.Fatalf("Expected ConfigDir to be different than %s by default, but was the same", tmpHome) |
| 299 | } |
| 300 | |
| 301 | // Update configDir |
| 302 | SetDir(tmpHome) |
| 303 | |
| 304 | if Dir() != tmpHome { |
| 305 | t.Fatalf("Expected ConfigDir to %s, but was %s", tmpHome, Dir()) |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | func TestJSONReaderNoFile(t *testing.T) { |
| 310 | js := ` { "auths": { "https://index.docker.io/v1/": { "auth": "am9lam9lOmhlbGxv", "email": "user@example.com" } } }` |