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