MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestGetAllAuthConfigs

Function TestGetAllAuthConfigs

pkg/devspace/docker/config_test.go:26–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24}
25
26func TestGetAllAuthConfigs(t *testing.T) {
27 testCases := []getAllAuthConfigsTestCase{
28 {
29 name: "empty dir",
30 },
31 {
32 name: "filled dir",
33 files: map[string]interface{}{
34 "config.json": configfile.ConfigFile{
35 AuthConfigs: map[string]configtypes.AuthConfig{
36 "key": {
37 Username: "ValUser",
38 Password: "ValPass",
39 Email: "ValEmail",
40 ServerAddress: "ValServerAddress",
41 IdentityToken: "ValIdentityToken",
42 RegistryToken: "ValRegistryToken",
43 },
44 },
45 },
46 },
47 expectedAuthConfigs: map[string]dockerregistry.AuthConfig{
48 "key": {
49 Username: "ValUser",
50 Password: "ValPass",
51 Email: "ValEmail",
52 ServerAddress: "key",
53 IdentityToken: "ValIdentityToken",
54 RegistryToken: "ValRegistryToken",
55 },
56 },
57 },
58 }
59
60 dir := t.TempDir()
61
62 wdBackup, err := os.Getwd()
63 if err != nil {
64 t.Fatalf("Error getting current working directory: %v", err)
65 }
66 err = os.Chdir(dir)
67 if err != nil {
68 t.Fatalf("Error changing working directory: %v", err)
69 }
70 dir, err = filepath.EvalSymlinks(dir)
71 if err != nil {
72 t.Fatal(err)
73 }
74
75 defer func() {
76 err = os.Chdir(wdBackup)
77 if err != nil {
78 t.Fatalf("Error changing dir back: %v", err)
79 }
80 }()
81
82 configDir = dir
83

Callers

nothing calls this directly

Calls 5

WriteToFileFunction · 0.92
GetAllAuthConfigsFunction · 0.85
EqualMethod · 0.80
FatalfMethod · 0.45
FatalMethod · 0.45

Tested by

no test coverage detected