2013-07-29 19:42:35 -04:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testAccessConfig() *AccessConfig {
|
|
|
|
return &AccessConfig{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAccessConfigPrepare_Region(t *testing.T) {
|
|
|
|
c := testAccessConfig()
|
|
|
|
c.RawRegion = ""
|
2013-08-08 17:29:46 -04:00
|
|
|
if err := c.Prepare(nil); err != nil {
|
2013-07-29 19:42:35 -04:00
|
|
|
t.Fatalf("shouldn't have err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
c.RawRegion = "us-east-12"
|
2013-08-08 17:29:46 -04:00
|
|
|
if err := c.Prepare(nil); err == nil {
|
2013-07-29 19:42:35 -04:00
|
|
|
t.Fatal("should have error")
|
|
|
|
}
|
|
|
|
|
|
|
|
c.RawRegion = "us-east-1"
|
2013-08-08 17:29:46 -04:00
|
|
|
if err := c.Prepare(nil); err != nil {
|
2013-07-29 19:42:35 -04:00
|
|
|
t.Fatalf("shouldn't have err: %s", err)
|
|
|
|
}
|
2016-06-06 14:17:12 -04:00
|
|
|
|
|
|
|
c.RawRegion = "custom"
|
|
|
|
if err := c.Prepare(nil); err == nil {
|
|
|
|
t.Fatalf("should have err")
|
|
|
|
}
|
|
|
|
|
|
|
|
c.RawRegion = "custom"
|
|
|
|
c.SkipValidation = true
|
|
|
|
if err := c.Prepare(nil); err != nil {
|
|
|
|
t.Fatalf("shouldn't have err: %s", err)
|
|
|
|
}
|
|
|
|
c.SkipValidation = false
|
|
|
|
|
2013-07-29 19:42:35 -04:00
|
|
|
}
|