2013-08-27 00:57:23 -04:00
|
|
|
package openstack
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testAccessConfig() *AccessConfig {
|
|
|
|
return &AccessConfig{}
|
|
|
|
}
|
|
|
|
|
2014-08-15 14:19:04 -04:00
|
|
|
func TestAccessConfigPrepare_NoRegion_Rackspace(t *testing.T) {
|
2013-09-01 16:22:22 -04:00
|
|
|
c := testAccessConfig()
|
2014-08-15 14:19:04 -04:00
|
|
|
c.Provider = "rackspace-us"
|
2013-09-01 16:22:22 -04:00
|
|
|
if err := c.Prepare(nil); err == nil {
|
|
|
|
t.Fatalf("shouldn't have err: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-15 14:19:04 -04:00
|
|
|
func TestAccessConfigPrepare_NoRegion_PrivateCloud(t *testing.T) {
|
|
|
|
c := testAccessConfig()
|
|
|
|
c.Provider = "http://some-keystone-server:5000/v2.0"
|
|
|
|
if err := c.Prepare(nil); err != nil {
|
|
|
|
t.Fatalf("shouldn't have err: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-27 00:57:23 -04:00
|
|
|
func TestAccessConfigPrepare_Region(t *testing.T) {
|
2013-09-01 16:22:22 -04:00
|
|
|
dfw := "DFW"
|
2013-08-27 00:57:23 -04:00
|
|
|
c := testAccessConfig()
|
2013-09-01 16:22:22 -04:00
|
|
|
c.RawRegion = dfw
|
2013-08-27 00:57:23 -04:00
|
|
|
if err := c.Prepare(nil); err != nil {
|
|
|
|
t.Fatalf("shouldn't have err: %s", err)
|
|
|
|
}
|
2013-09-01 16:22:22 -04:00
|
|
|
if dfw != c.Region() {
|
|
|
|
t.Fatalf("Regions do not match: %s %s", dfw, c.Region())
|
|
|
|
}
|
2013-08-27 00:57:23 -04:00
|
|
|
}
|