(t *testing.T)
| 137 | } |
| 138 | |
| 139 | func 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 | |
| 162 | func TestNew_APIURL_customConfig(t *testing.T) { |
| 163 | t.Setenv("GITHUB_API_URL", "") |
nothing calls this directly
no test coverage detected