(t *testing.T)
| 270 | } |
| 271 | |
| 272 | func TestNew_ServerURL_env(t *testing.T) { |
| 273 | t.Setenv("GITHUB_SERVER_URL", "https://mycompany.com") |
| 274 | t.Setenv("GITHUB_API_URL", "https://api.mycompany.com") |
| 275 | cfg := &ghmock.ConfigMock{ |
| 276 | AuthenticationFunc: func() gh.AuthConfig { |
| 277 | return &config.AuthConfig{} |
| 278 | }, |
| 279 | } |
| 280 | f := &cmdutil.Factory{ |
| 281 | Config: func() (gh.Config, error) { |
| 282 | return cfg, nil |
| 283 | }, |
| 284 | } |
| 285 | api := New(f) |
| 286 | |
| 287 | if api.githubServer != "https://mycompany.com" { |
| 288 | t.Fatalf("expected https://mycompany.com, got %s", api.githubServer) |
| 289 | } |
| 290 | if len(cfg.AuthenticationCalls()) != 0 { |
| 291 | t.Fatalf("Configuration was checked instead of using the GITHUB_SERVER_URL environment variable") |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | func TestNew_ServerURL_dotcomFallback(t *testing.T) { |
| 296 | t.Setenv("GITHUB_SERVER_URL", "") |
nothing calls this directly
no test coverage detected