+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: Apache-2.0
+
package arvados
import (
"net/url"
"sync"
"testing"
+ "testing/iotest"
)
type stubTransport struct {
return nil, fmt.Errorf("something awful happened")
}
+type timeoutTransport struct {
+ response []byte
+}
+
+func (stub *timeoutTransport) RoundTrip(req *http.Request) (*http.Response, error) {
+ return &http.Response{
+ Status: "200 OK",
+ StatusCode: 200,
+ Proto: "HTTP/1.1",
+ ProtoMajor: 1,
+ ProtoMinor: 1,
+ Request: req,
+ Body: ioutil.NopCloser(iotest.TimeoutReader(bytes.NewReader(stub.response))),
+ }, nil
+}
+
func TestCurrentUser(t *testing.T) {
t.Parallel()
stub := &stubTransport{
},
},
{
- in: map[string]interface{}{"foo": map[string]interface{}{"bar":1.234}},
+ in: map[string]interface{}{"foo": map[string]interface{}{"bar": 1.234}},
ok: func(out url.Values) bool {
return out.Get("foo") == `{"bar":1.234}`
},