MCPcopy Index your code
hub / github.com/google/go-github / TestClient_Clone

Function TestClient_Clone

github/github_test.go:1233–1530  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1231}
1232
1233func TestClient_Clone(t *testing.T) {
1234 t.Parallel()
1235
1236 t.Run("uninitialized_client", func(t *testing.T) {
1237 t.Parallel()
1238
1239 var c Client
1240
1241 _, err := c.Clone()
1242 if err == nil || !errors.Is(err, errUninitialized) {
1243 t.Fatalf("Client.Clone returned unexpected error: %v", err)
1244 }
1245 })
1246
1247 t.Run("initialized_client_opts_err", func(t *testing.T) {
1248 t.Parallel()
1249
1250 c := mustNewClient(t)
1251
1252 _, err := c.Clone(func(_ *clientOptions) error {
1253 return errors.New("test options error")
1254 })
1255 if err == nil || err.Error() != "test options error" {
1256 t.Fatalf("Client.Clone returned unexpected error: %v", err)
1257 }
1258 })
1259
1260 t.Run("initialized_client_new_client_err", func(t *testing.T) {
1261 t.Parallel()
1262
1263 c := mustNewClient(t)
1264
1265 _, err := c.Clone(WithTransport(roundTripperFunc(func(_ *http.Request) (*http.Response, error) {
1266 return nil, nil
1267 })), WithEnvProxy())
1268 if err == nil || err.Error() != "cannot set environment proxy on non-http transport" {
1269 t.Fatalf("Client.Clone returned unexpected error: %v", err)
1270 }
1271 })
1272
1273 t.Run("initialized_client", func(t *testing.T) {
1274 t.Parallel()
1275
1276 c := mustNewClient(t)
1277 c.userAgent = "CustomUserAgent/1.0"
1278 c.baseURL.Path = "/custom/"
1279 c.uploadURL.Path = "/custom-upload/"
1280 c.disableRateLimitCheck = false
1281 c.rateLimitRedirectionalEndpoints = true
1282 c.maxSecondaryRateLimitRetryAfterDuration = 2 * time.Minute
1283 c.Marketplace.Stubbed = true
1284 c.client.Transport = &http.Transport{IdleConnTimeout: 10 * time.Second}
1285 c.client.CheckRedirect = func(_ *http.Request, _ []*http.Request) error { return nil }
1286 c.client.Timeout = 15 * time.Second
1287 c.rateLimits[CoreCategory].Remaining = 100
1288 c.secondaryRateLimitReset = time.Now().Add(30 * time.Second)
1289
1290 cloned, err := c.Clone()

Callers

nothing calls this directly

Calls 13

CloneMethod · 0.95
mustNewClientFunction · 0.85
WithTransportFunction · 0.85
roundTripperFuncFuncType · 0.85
WithEnvProxyFunction · 0.85
WithHTTPClientFunction · 0.85
WithTimeoutFunction · 0.85
AddMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.45
IsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…