diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2018-02-19 20:51:16 +0100 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2018-02-19 20:51:16 +0100 |
| commit | 8f777460661bbbcbe42730979140f525b382110e (patch) | |
| tree | f6360dc2f4c7ce9342de38c88cde247fa70a4467 /shared_test.go | |
| parent | 46081e2068aeea62783863515ab116bb6af20661 (diff) | |
| download | go-schwift-8f777460661bbbcbe42730979140f525b382110e.tar.gz | |
introduce Client interface
Diffstat (limited to 'shared_test.go')
| -rw-r--r-- | shared_test.go | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/shared_test.go b/shared_test.go index 2c1d204..16113e2 100644 --- a/shared_test.go +++ b/shared_test.go @@ -23,8 +23,6 @@ import ( "crypto/rand" "encoding/hex" "math" - "net/http" - "net/url" "os" "testing" @@ -33,26 +31,6 @@ import ( "github.com/gophercloud/gophercloud/openstack/objectstorage/v1/swauth" ) -//This function can be used during debugging to redirect the HTTP requests for -//a specific unit test through a mitmproxy. Put this at the beginning of your -//testcase like so: -// -// testWithAccount(t, func(a *Account) { -// withProxy(a, "http://localhost:8888", func() { -// ... -// -// testWithContainer(t, func(c *Container) { -// 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 - action() - t.Proxy = proxyOrig -} - func testWithAccount(t *testing.T, testCode func(a *Account)) { stAuth := os.Getenv("ST_AUTH") stUser := os.Getenv("ST_USER") @@ -91,9 +69,9 @@ func testWithAccount(t *testing.T, testCode func(a *Account)) { } } - account, err := AccountFromClient(client) + account, err := AccountFromGophercloud(client) if err != nil { - t.Errorf("schwift.AccountFromClient returned: " + err.Error()) + t.Errorf("schwift.AccountFromGophercloud returned: " + err.Error()) return } testCode(account) |
