aboutsummaryrefslogtreecommitdiff
path: root/shared_test.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2018-02-16 17:54:20 +0100
committerStefan Majewsky <majewsky@gmx.net>2018-02-16 17:54:20 +0100
commitee7bf40967cd142ed1172596055dae2cc254df2c (patch)
tree8e0da8819e5d700ad8ded7bbf3be7185fcd9a7c0 /shared_test.go
parente348d99cd0fd39febbfcfc6a676a1c902d4bd461 (diff)
downloadgo-schwift-ee7bf40967cd142ed1172596055dae2cc254df2c.tar.gz
make govet happy
Diffstat (limited to 'shared_test.go')
-rw-r--r--shared_test.go17
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)) {