blob: 1eac681b571321d9c3324fb60d230a9ad0b7a024 [file] [log] [blame]
Jon Perrittf050a4c2014-09-11 15:01:17 -05001// +build acceptance
2
3package v1
4
5import (
Jon Perritt2a7797d2014-10-21 15:08:43 -05006 "os"
Ash Wilson0036cbf2014-10-24 15:29:48 -04007 "testing"
Jon Perritt2a7797d2014-10-21 15:08:43 -05008
Jon Perrittf050a4c2014-09-11 15:01:17 -05009 "github.com/rackspace/gophercloud"
10 "github.com/rackspace/gophercloud/openstack"
Jon Perritt2a7797d2014-10-21 15:08:43 -050011 th "github.com/rackspace/gophercloud/testhelper"
Jon Perrittf050a4c2014-09-11 15:01:17 -050012)
13
14var metadata = map[string]string{"gopher": "cloud"}
15
Ash Wilson0036cbf2014-10-24 15:29:48 -040016func newClient(t *testing.T) *gophercloud.ServiceClient {
Jamie Hannaford390555a2014-10-22 17:04:03 +020017 ao, err := openstack.AuthOptionsFromEnv()
Jon Perritt2a7797d2014-10-21 15:08:43 -050018 th.AssertNoErr(t, err)
Jon Perrittf050a4c2014-09-11 15:01:17 -050019
20 client, err := openstack.AuthenticatedClient(ao)
Jon Perritt2a7797d2014-10-21 15:08:43 -050021 th.AssertNoErr(t, err)
Jon Perrittf050a4c2014-09-11 15:01:17 -050022
Jon Perritt2b36fa32014-10-24 15:44:23 -050023 c, err := openstack.NewObjectStorageV1(client, gophercloud.EndpointOpts{
Jon Perrittf050a4c2014-09-11 15:01:17 -050024 Region: os.Getenv("OS_REGION_NAME"),
Ash Wilson0036cbf2014-10-24 15:29:48 -040025 })
Jon Perritt2b36fa32014-10-24 15:44:23 -050026 th.AssertNoErr(t, err)
27 return c
Jon Perrittf050a4c2014-09-11 15:01:17 -050028}