chore: fix test

This commit is contained in:
Marin Salinas 2020-10-13 12:54:25 -05:00
parent 09f57537bf
commit 2578bbbb50
2 changed files with 10 additions and 4 deletions

View File

@ -12,19 +12,25 @@ func TestAccessConfigPrepare_Region(t *testing.T) {
c := testAccessConfig()
c.RawRegion = "us-east-12"
err := c.ValidateRegion(c.RawRegion)
err := c.ValidateOSCRegion(c.RawRegion)
if err == nil {
t.Fatalf("should have region validation err: %s", c.RawRegion)
}
c.RawRegion = "us-east-1"
err = c.ValidateRegion(c.RawRegion)
err := c.ValidateOSCRegion(c.RawRegion)
if err == nil {
t.Fatalf("should have region validation err: %s", c.RawRegion)
}
c.RawRegion = "us-west-1"
err = c.ValidateOSCRegion(c.RawRegion)
if err != nil {
t.Fatalf("shouldn't have region validation err: %s", c.RawRegion)
}
c.RawRegion = "custom"
err = c.ValidateRegion(c.RawRegion)
err = c.ValidateOSCRegion(c.RawRegion)
if err == nil {
t.Fatalf("should have region validation err: %s", c.RawRegion)
}

View File

@ -28,7 +28,7 @@ func listOSCRegions(oscconn *osc.RegionApiService) ([]string, error) {
// ValidateRegion returns true if the supplied region is a valid Outscale
// region and false if it's not.
func (c *AccessConfig) ValidateRegion(regions ...string) error {
func (c *AccessConfig) ValidateOSCRegion(regions ...string) error {
oscconn := c.NewOSCClient()
validRegions, err := listOSCRegions(oscconn.RegionApi)