fix tests

This commit is contained in:
vilmibm 2020-05-15 16:47:11 -05:00
parent 96ba1eacef
commit 780875d645
3 changed files with 5 additions and 2 deletions

View file

@ -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)

View file

@ -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

View file

@ -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
}