Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood 2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483201 additions and 5922 deletions

56
vendor/github.com/ncw/go-acd/client_mock_test.go generated vendored Normal file
View file

@ -0,0 +1,56 @@
// Copyright (c) 2015 Serge Gebhardt. All rights reserved.
//
// Use of this source code is governed by the ISC
// license that can be found in the LICENSE file.
package acd
import (
"bytes"
"io/ioutil"
"net/http"
)
// MockResponse is a static HTTP response.
type MockResponse struct {
Code int
Body []byte
}
// NewMockResponseOkString creates a new MockResponse with Code 200 (OK)
// and Body built from string argument
func NewMockResponseOkString(response string) *MockResponse {
return &MockResponse{
Code: 200,
Body: []byte(response),
}
}
// mockTransport is a mocked Transport that always returns the same MockResponse.
type mockTransport struct {
resp MockResponse
}
// Satisfies the RoundTripper interface.
func (t *mockTransport) RoundTrip(req *http.Request) (*http.Response, error) {
r := http.Response{
StatusCode: t.resp.Code,
Proto: "HTTP/1.0",
ProtoMajor: 1,
ProtoMinor: 0,
}
if len(t.resp.Body) > 0 {
buf := bytes.NewBuffer(t.resp.Body)
r.Body = ioutil.NopCloser(buf)
}
return &r, nil
}
// MockClient is a mocked Client that is used for tests.
func NewMockClient(response MockResponse) *Client {
t := &mockTransport{resp: response}
c := &http.Client{Transport: t}
return NewClient(c)
}