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

Function Test_newClient

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

Source from the content-addressed store, hash-verified

978}
979
980func Test_newClient(t *testing.T) {
981 t.Parallel()
982
983 for _, tt := range []struct {
984 name string
985 opts clientOptions
986 wantErr string
987 }{
988 {
989 name: "default_options",
990 opts: clientOptions{},
991 wantErr: "",
992 },
993 {
994 name: "with_http_client",
995 opts: clientOptions{
996 httpClient: &http.Client{Transport: &http.Transport{IdleConnTimeout: 5 * time.Second}},
997 },
998 wantErr: "",
999 },
1000 {
1001 name: "with_transport",
1002 opts: clientOptions{
1003 transport: &http.Transport{IdleConnTimeout: 10 * time.Second},
1004 },
1005 wantErr: "",
1006 },
1007 {
1008 name: "with_all_options",
1009 opts: clientOptions{
1010 httpClient: &http.Client{Transport: &http.Transport{IdleConnTimeout: 5 * time.Second}},
1011 transport: &http.Transport{IdleConnTimeout: 10 * time.Second},
1012 timeout: Ptr(15 * time.Second),
1013 userAgent: Ptr("CustomUserAgent/1.0"),
1014 baseURL: mustParseURL(t, "https://custom-url/api/v3/"),
1015 uploadURL: mustParseURL(t, "https://custom-upload-url/api/uploads/"),
1016 disableRateLimitCheck: true,
1017 rateLimitRedirectionalEndpoints: true,
1018 maxSecondaryRateLimitRetryAfterDuration: Ptr(2 * time.Minute),
1019 },
1020 wantErr: "",
1021 },
1022 {
1023 name: "with_rate_limit_options",
1024 opts: clientOptions{
1025 disableRateLimitCheck: false,
1026 rateLimitRedirectionalEndpoints: true,
1027 maxSecondaryRateLimitRetryAfterDuration: Ptr(2 * time.Minute),
1028 },
1029 wantErr: "",
1030 },
1031 {
1032 name: "with_env_proxy",
1033 opts: clientOptions{
1034 envProxy: true,
1035 },
1036 wantErr: "",
1037 },

Callers

nothing calls this directly

Calls 7

mustParseURLFunction · 0.85
roundTripperFuncFuncType · 0.85
PtrFunction · 0.70
newClientFunction · 0.70
RunMethod · 0.45
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…