MCPcopy Index your code
hub / github.com/cli/cli / TestNew_APIURL_dotcomConfig

Function TestNew_APIURL_dotcomConfig

internal/codespaces/api/api_test.go:139–160  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestNew_APIURL_dotcomConfig(t *testing.T) {
140 t.Setenv("GITHUB_API_URL", "")
141 t.Setenv("GITHUB_SERVER_URL", "https://github.com")
142 cfg := &ghmock.ConfigMock{
143 AuthenticationFunc: func() gh.AuthConfig {
144 return &config.AuthConfig{}
145 },
146 }
147 f := &cmdutil.Factory{
148 Config: func() (gh.Config, error) {
149 return cfg, nil
150 },
151 }
152 api := New(f)
153
154 if api.githubAPI != "https://api.github.com" {
155 t.Fatalf("expected https://api.github.com, got %s", api.githubAPI)
156 }
157 if len(cfg.AuthenticationCalls()) != 1 {
158 t.Fatalf("API url was not pulled from the config")
159 }
160}
161
162func TestNew_APIURL_customConfig(t *testing.T) {
163 t.Setenv("GITHUB_API_URL", "")

Callers

nothing calls this directly

Calls 2

AuthenticationCallsMethod · 0.95
NewFunction · 0.70

Tested by

no test coverage detected