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

Function TestGetRegistryEndpoint

pkg/devspace/docker/auth_test.go:72–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestGetRegistryEndpoint(t *testing.T) {
73 testCases := []getRegistryEndpointTestCase{
74 {
75 name: "Use auth server",
76 expectedIsDefault: true,
77 expectedEndpoint: "IndexServerAddress",
78 },
79 {
80 name: "Use custom server",
81 registryURL: "custom",
82 expectedIsDefault: false,
83 expectedEndpoint: "custom",
84 },
85 }
86
87 for _, testCase := range testCases {
88 client := &client{
89 APIClient: &fakeDockerClient{},
90 }
91
92 isDefault, endpoint, err := client.GetRegistryEndpoint(context.Background(), testCase.registryURL)
93
94 if !testCase.expectedErr {
95 assert.NilError(t, err, "Unexpected error in testCase %s", testCase.name)
96 } else if err == nil {
97 t.Fatalf("Unexpected error %v in testCase %s", err, testCase.name)
98 }
99
100 assert.Equal(t, isDefault, testCase.expectedIsDefault, "Unexpected isDefault bool in testCase %s", testCase.name)
101 assert.Equal(t, endpoint, testCase.expectedEndpoint, "Unexpected endpoint in testCase %s", testCase.name)
102 }
103}
104
105type getAuthConfigTestCase struct {
106 name string

Callers

nothing calls this directly

Calls 3

GetRegistryEndpointMethod · 0.95
EqualMethod · 0.80
FatalfMethod · 0.45

Tested by

no test coverage detected