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

Function TestNew_ServerURL_dotcomConfig

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

Source from the content-addressed store, hash-verified

222}
223
224func TestNew_ServerURL_dotcomConfig(t *testing.T) {
225 t.Setenv("GITHUB_SERVER_URL", "")
226 t.Setenv("GITHUB_API_URL", "https://api.github.com")
227 cfg := &ghmock.ConfigMock{
228 AuthenticationFunc: func() gh.AuthConfig {
229 return &config.AuthConfig{}
230 },
231 }
232 f := &cmdutil.Factory{
233 Config: func() (gh.Config, error) {
234 return cfg, nil
235 },
236 }
237 api := New(f)
238
239 if api.githubServer != "https://github.com" {
240 t.Fatalf("expected https://github.com, got %s", api.githubServer)
241 }
242 if len(cfg.AuthenticationCalls()) != 1 {
243 t.Fatalf("Server url was not pulled from the config")
244 }
245}
246
247func TestNew_ServerURL_customConfig(t *testing.T) {
248 t.Setenv("GITHUB_SERVER_URL", "")

Callers

nothing calls this directly

Calls 2

AuthenticationCallsMethod · 0.95
NewFunction · 0.70

Tested by

no test coverage detected