aboutsummaryrefslogtreecommitdiff
path: root/shared_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'shared_test.go')
-rw-r--r--shared_test.go26
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)