X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9f6a124c856292511726e679ebfbb96e0d640046..0e2a467a923bd490f3e1dc4d8c00a9e2f29e59d4:/sdk/go/arvadostest/api.go diff --git a/sdk/go/arvadostest/api.go b/sdk/go/arvadostest/api.go index a3cacf3f6c..24e9f19086 100644 --- a/sdk/go/arvadostest/api.go +++ b/sdk/go/arvadostest/api.go @@ -6,7 +6,11 @@ package arvadostest import ( "context" + "encoding/json" "errors" + "net/url" + "reflect" + "runtime" "sync" "git.curoverse.com/arvados.git/sdk/go/arvados" @@ -21,6 +25,18 @@ type APIStub struct { mtx sync.Mutex } +// BaseURL implements federation.backend +func (as *APIStub) BaseURL() url.URL { + return url.URL{Scheme: "https", Host: "apistub.example.com"} +} +func (as *APIStub) ConfigGet(ctx context.Context) (json.RawMessage, error) { + as.appendCall(as.ConfigGet, ctx, nil) + return nil, as.Error +} +func (as *APIStub) Login(ctx context.Context, options arvados.LoginOptions) (arvados.LoginResponse, error) { + as.appendCall(as.Login, ctx, options) + return arvados.LoginResponse{}, as.Error +} func (as *APIStub) CollectionCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Collection, error) { as.appendCall(as.CollectionCreate, ctx, options) return arvados.Collection{}, as.Error @@ -121,7 +137,9 @@ func (as *APIStub) Calls(method interface{}) []APIStubCall { defer as.mtx.Unlock() var calls []APIStubCall for _, call := range as.calls { - if method == nil || call.Method == method { + + if method == nil || (runtime.FuncForPC(reflect.ValueOf(call.Method).Pointer()).Name() == + runtime.FuncForPC(reflect.ValueOf(method).Pointer()).Name()) { calls = append(calls, call) } }