Skip to content

Commit ffaa4a4

Browse files
committed
Address review comments
1 parent dd1fb83 commit ffaa4a4

File tree

3 files changed

+3
-63
lines changed

3 files changed

+3
-63
lines changed

github/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ func WithPreChainTransportHook(preRoundTripperFunc gitprovider.ChainableRoundTri
152152
return buildCommonOption(gitprovider.CommonClientOptions{PreChainTransportHook: preRoundTripperFunc})
153153
}
154154

155-
// WithPostChainTransportHook registers a ChainableRoundTripperFunc "before" the cache and authentication
156-
// transports in the chain. For more information, see NewClient, and gitprovider.CommonClientOptions.PreChainTransportHook.
155+
// WithPostChainTransportHook registers a ChainableRoundTripperFunc "after" the cache and authentication
156+
// transports in the chain. For more information, see NewClient, and gitprovider.CommonClientOptions.WithPostChainTransportHook.
157157
func WithPostChainTransportHook(postRoundTripperFunc gitprovider.ChainableRoundTripperFunc) ClientOption {
158158
// Don't allow an empty value
159159
if postRoundTripperFunc == nil {

gitprovider/client_options_test.go

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -123,66 +123,6 @@ func Test_makeOptions(t *testing.T) {
123123
opts: []commonClientOption{withPostChainTransportHook(dummyRoundTripper1), withPostChainTransportHook(dummyRoundTripper1)},
124124
expectedErrs: []error{ErrInvalidClientOptions},
125125
},
126-
/*{
127-
name: "WithDestructiveAPICalls",
128-
opts: []ClientOption{WithDestructiveAPICalls(true)},
129-
want: buildCommonOption(gitprovider.CommonClientOptions{EnableDestructiveAPICalls: gitprovider.BoolVar(true)}),
130-
},
131-
{
132-
name: "WithPreChainTransportHook",
133-
opts: []ClientOption{WithPreChainTransportHook(dummyRoundTripper1)},
134-
want: buildCommonOption(gitprovider.CommonClientOptions{PreChainTransportHook: dummyRoundTripper1}),
135-
},
136-
{
137-
name: "WithPreChainTransportHook, nil",
138-
opts: []ClientOption{WithPreChainTransportHook(nil)},
139-
expectedErrs: []error{gitprovider.ErrInvalidClientOptions},
140-
},
141-
{
142-
name: "WithPostChainTransportHook",
143-
opts: []ClientOption{WithPostChainTransportHook(dummyRoundTripper2)},
144-
want: buildCommonOption(gitprovider.CommonClientOptions{PostChainTransportHook: dummyRoundTripper2}),
145-
},
146-
{
147-
name: "WithPostChainTransportHook, nil",
148-
opts: []ClientOption{WithPostChainTransportHook(nil)},
149-
expectedErrs: []error{gitprovider.ErrInvalidClientOptions},
150-
},
151-
{
152-
name: "WithOAuth2Token",
153-
opts: []ClientOption{WithOAuth2Token("foo")},
154-
want: &clientOptions{AuthTransport: oauth2Transport("foo")},
155-
},
156-
{
157-
name: "WithOAuth2Token, empty",
158-
opts: []ClientOption{WithOAuth2Token("")},
159-
expectedErrs: []error{gitprovider.ErrInvalidClientOptions},
160-
},
161-
{
162-
name: "WithPersonalAccessToken",
163-
opts: []ClientOption{WithPersonalAccessToken("foo")},
164-
want: &clientOptions{AuthTransport: patTransport("foo")},
165-
},
166-
{
167-
name: "WithPersonalAccessToken, empty",
168-
opts: []ClientOption{WithPersonalAccessToken("")},
169-
expectedErrs: []error{gitprovider.ErrInvalidClientOptions},
170-
},
171-
{
172-
name: "WithPersonalAccessToken and WithOAuth2Token, exclusive",
173-
opts: []ClientOption{WithPersonalAccessToken("foo"), WithOAuth2Token("foo")},
174-
expectedErrs: []error{gitprovider.ErrInvalidClientOptions},
175-
},
176-
{
177-
name: "WithConditionalRequests",
178-
opts: []ClientOption{WithConditionalRequests(true)},
179-
want: &clientOptions{EnableConditionalRequests: gitprovider.BoolVar(true)},
180-
},
181-
{
182-
name: "WithConditionalRequests, exclusive",
183-
opts: []ClientOption{WithConditionalRequests(true), WithConditionalRequests(false)},
184-
expectedErrs: []error{gitprovider.ErrInvalidClientOptions},
185-
},*/
186126
}
187127
for _, tt := range tests {
188128
t.Run(tt.name, func(t *testing.T) {

gitprovider/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var (
5959
ErrInvalidClientOptions = errors.New("invalid options given to NewClient()")
6060
// ErrDestructiveCallDisallowed happens when the client isn't set up with WithDestructiveAPICalls()
6161
// but a destructive action is called.
62-
ErrDestructiveCallDisallowed = errors.New("a destructive call was blocked because it wasn't allowed by the client")
62+
ErrDestructiveCallDisallowed = errors.New("destructive call was blocked, disallowed by client")
6363
// ErrInvalidTransportChainReturn is returned if a ChainableRoundTripperFunc returns nil, which is invalid.
6464
ErrInvalidTransportChainReturn = errors.New("the return value of a ChainableRoundTripperFunc must not be nil")
6565
)

0 commit comments

Comments
 (0)