chore: fix test
This commit is contained in:
parent
09f57537bf
commit
2578bbbb50
|
@ -12,19 +12,25 @@ func TestAccessConfigPrepare_Region(t *testing.T) {
|
||||||
c := testAccessConfig()
|
c := testAccessConfig()
|
||||||
|
|
||||||
c.RawRegion = "us-east-12"
|
c.RawRegion = "us-east-12"
|
||||||
err := c.ValidateRegion(c.RawRegion)
|
err := c.ValidateOSCRegion(c.RawRegion)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("should have region validation err: %s", c.RawRegion)
|
t.Fatalf("should have region validation err: %s", c.RawRegion)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.RawRegion = "us-east-1"
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("shouldn't have region validation err: %s", c.RawRegion)
|
t.Fatalf("shouldn't have region validation err: %s", c.RawRegion)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.RawRegion = "custom"
|
c.RawRegion = "custom"
|
||||||
err = c.ValidateRegion(c.RawRegion)
|
err = c.ValidateOSCRegion(c.RawRegion)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("should have region validation err: %s", c.RawRegion)
|
t.Fatalf("should have region validation err: %s", c.RawRegion)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ func listOSCRegions(oscconn *osc.RegionApiService) ([]string, error) {
|
||||||
|
|
||||||
// ValidateRegion returns true if the supplied region is a valid Outscale
|
// ValidateRegion returns true if the supplied region is a valid Outscale
|
||||||
// region and false if it's not.
|
// region and false if it's not.
|
||||||
func (c *AccessConfig) ValidateRegion(regions ...string) error {
|
func (c *AccessConfig) ValidateOSCRegion(regions ...string) error {
|
||||||
oscconn := c.NewOSCClient()
|
oscconn := c.NewOSCClient()
|
||||||
|
|
||||||
validRegions, err := listOSCRegions(oscconn.RegionApi)
|
validRegions, err := listOSCRegions(oscconn.RegionApi)
|
||||||
|
|
Loading…
Reference in New Issue