diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-02-16 17:54:20 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-02-16 17:54:20 +0100 |
| commit | ee7bf40967cd142ed1172596055dae2cc254df2c (patch) | |
| tree | 8e0da8819e5d700ad8ded7bbf3be7185fcd9a7c0 | |
| parent | e348d99cd0fd39febbfcfc6a676a1c902d4bd461 (diff) | |
| download | go-schwift-ee7bf40967cd142ed1172596055dae2cc254df2c.tar.gz | |
make govet happy
| -rw-r--r-- | shared_test.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/shared_test.go b/shared_test.go index ba05453..91a9727 100644 --- a/shared_test.go +++ b/shared_test.go @@ -37,16 +37,19 @@ import ( //testcase like so: // // testWithAccount(t, func(a *Account) { -// useProxy(a, "http://localhost:8888") -// ... +// withProxy(a, "http://localhost:8888", func() { +// ... // // testWithContainer(t, func(c *Container) { -// useProxy(c.Account(), "http://localhost:8888") -// ... -func useProxy(a *Account, proxyURL string) { - t := *(http.DefaultTransport.(*http.Transport)) +// withProxy(c.Account(), "http://localhost:8888", func() { +// ... +func withProxy(a *Account, proxyURL string, action func()) { + t := http.DefaultTransport.(*http.Transport) + proxyOrig := t.Proxy t.Proxy = func(*http.Request) (*url.URL, error) { return url.Parse(proxyURL) } - a.client.ProviderClient.HTTPClient.Transport = &t + a.client.ProviderClient.HTTPClient.Transport = t + action() + t.Proxy = proxyOrig } func testWithAccount(t *testing.T, testCode func(a *Account)) { |
