blob: 81704187fef52b19e983611b5bebcd2844bc8ca6 [file] [log] [blame]
Jon Perritt53c8a3a2014-11-24 07:46:35 -07001package v2
2
3import (
4 "os"
5 "testing"
6
7 "github.com/rackspace/gophercloud"
8 "github.com/rackspace/gophercloud/rackspace"
9 th "github.com/rackspace/gophercloud/testhelper"
10)
11
12var Client *gophercloud.ServiceClient
13
14func NewClient() (*gophercloud.ServiceClient, error) {
15 opts, err := rackspace.AuthOptionsFromEnv()
16 if err != nil {
17 return nil, err
18 }
19
20 provider, err := rackspace.AuthenticatedClient(opts)
21 if err != nil {
22 return nil, err
23 }
24
25 return rackspace.NewNetworkV2(provider, gophercloud.EndpointOpts{
26 Name: "cloudNetworks",
27 Region: os.Getenv("RS_REGION"),
28 })
29}
30
31func Setup(t *testing.T) {
32 client, err := NewClient()
33 th.AssertNoErr(t, err)
34 Client = client
35}
36
37func Teardown() {
38 Client = nil
39}