(t *testing.T)
| 185 | } |
| 186 | |
| 187 | func TestNew_APIURL_env(t *testing.T) { |
| 188 | t.Setenv("GITHUB_API_URL", "https://api.mycompany.com") |
| 189 | t.Setenv("GITHUB_SERVER_URL", "https://mycompany.com") |
| 190 | cfg := &ghmock.ConfigMock{ |
| 191 | AuthenticationFunc: func() gh.AuthConfig { |
| 192 | return &config.AuthConfig{} |
| 193 | }, |
| 194 | } |
| 195 | f := &cmdutil.Factory{ |
| 196 | Config: func() (gh.Config, error) { |
| 197 | return cfg, nil |
| 198 | }, |
| 199 | } |
| 200 | api := New(f) |
| 201 | |
| 202 | if api.githubAPI != "https://api.mycompany.com" { |
| 203 | t.Fatalf("expected https://api.mycompany.com, got %s", api.githubAPI) |
| 204 | } |
| 205 | if len(cfg.AuthenticationCalls()) != 0 { |
| 206 | t.Fatalf("Configuration was checked instead of using the GITHUB_API_URL environment variable") |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | func TestNew_APIURL_dotcomFallback(t *testing.T) { |
| 211 | t.Setenv("GITHUB_API_URL", "") |
nothing calls this directly
no test coverage detected