Jamie Hannaford | af209d1 | 2014-10-22 12:37:48 +0200 | [diff] [blame] | 1 | package v1 |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/rackspace/gophercloud" |
Jamie Hannaford | af209d1 | 2014-10-22 12:37:48 +0200 | [diff] [blame] | 7 | "github.com/rackspace/gophercloud/rackspace" |
| 8 | th "github.com/rackspace/gophercloud/testhelper" |
| 9 | ) |
| 10 | |
| 11 | func newClient() (*gophercloud.ServiceClient, error) { |
Jamie Hannaford | 29149be | 2014-10-23 14:49:44 +0200 | [diff] [blame^] | 12 | opts, err := rackspace.AuthOptionsFromEnv() |
Jamie Hannaford | af209d1 | 2014-10-22 12:37:48 +0200 | [diff] [blame] | 13 | if err != nil { |
| 14 | return nil, err |
| 15 | } |
| 16 | |
| 17 | provider, err := rackspace.AuthenticatedClient(opts) |
| 18 | if err != nil { |
| 19 | return nil, err |
| 20 | } |
| 21 | |
| 22 | return rackspace.NewBlockStorageV1(provider, gophercloud.EndpointOpts{ |
| 23 | Region: "IAD", |
| 24 | }) |
| 25 | } |
| 26 | |
| 27 | func setup(t *testing.T) *gophercloud.ServiceClient { |
| 28 | client, err := newClient() |
| 29 | th.AssertNoErr(t, err) |
| 30 | |
| 31 | return client |
| 32 | } |