(t *testing.T)
| 245 | } |
| 246 | |
| 247 | func TestNew_ServerURL_customConfig(t *testing.T) { |
| 248 | t.Setenv("GITHUB_SERVER_URL", "") |
| 249 | t.Setenv("GITHUB_API_URL", "https://github.mycompany.com/api/v3") |
| 250 | cfg := &ghmock.ConfigMock{ |
| 251 | AuthenticationFunc: func() gh.AuthConfig { |
| 252 | authCfg := &config.AuthConfig{} |
| 253 | authCfg.SetDefaultHost("github.mycompany.com", "GH_HOST") |
| 254 | return authCfg |
| 255 | }, |
| 256 | } |
| 257 | f := &cmdutil.Factory{ |
| 258 | Config: func() (gh.Config, error) { |
| 259 | return cfg, nil |
| 260 | }, |
| 261 | } |
| 262 | api := New(f) |
| 263 | |
| 264 | if api.githubServer != "https://github.mycompany.com" { |
| 265 | t.Fatalf("expected https://github.mycompany.com, got %s", api.githubServer) |
| 266 | } |
| 267 | if len(cfg.AuthenticationCalls()) != 1 { |
| 268 | t.Fatalf("Server url was not pulled from the config") |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | func TestNew_ServerURL_env(t *testing.T) { |
| 273 | t.Setenv("GITHUB_SERVER_URL", "https://mycompany.com") |
nothing calls this directly
no test coverage detected