fix tests
This commit is contained in:
parent
96ba1eacef
commit
780875d645
3 changed files with 5 additions and 2 deletions
|
|
@ -23,7 +23,7 @@ func TestGistCreate(t *testing.T) {
|
|||
}
|
||||
`))
|
||||
|
||||
output, err := RunCommand(gistCreateCmd, `gist create -f "../test/fixtures/gistCreate.json" -d "Gist description" -p=false`)
|
||||
output, err := RunCommand(`gist create -f "../test/fixtures/gistCreate.json" -d "Gist description" -p=false`)
|
||||
eq(t, err, nil)
|
||||
|
||||
bodyBytes, _ := ioutil.ReadAll(http.Requests[0].Body)
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ var apiClientForContext = func(ctx context.Context) (*api.Client, error) {
|
|||
return api.NewClient(opts...), nil
|
||||
}
|
||||
|
||||
func ensureScopes(ctx context.Context, client *api.Client, wantedScopes ...string) (*api.Client, error) {
|
||||
var ensureScopes = func(ctx context.Context, client *api.Client, wantedScopes ...string) (*api.Client, error) {
|
||||
hasScopes, appID, err := client.HasScopes(wantedScopes...)
|
||||
if err != nil {
|
||||
return client, err
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ func initBlankContext(cfg, repo, branch string) {
|
|||
|
||||
func initFakeHTTP() *httpmock.Registry {
|
||||
http := &httpmock.Registry{}
|
||||
ensureScopes = func(ctx context.Context, client *api.Client, wantedScopes ...string) (*api.Client, error) {
|
||||
return client, nil
|
||||
}
|
||||
apiClientForContext = func(context.Context) (*api.Client, error) {
|
||||
return api.NewClient(api.ReplaceTripper(http)), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue