github.com/alouche/packer@v0.3.7/builder/openstack/access_config_test.go (about)

     1  package openstack
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func testAccessConfig() *AccessConfig {
     8  	return &AccessConfig{}
     9  }
    10  
    11  func TestAccessConfigPrepare_NoRegion(t *testing.T) {
    12  	c := testAccessConfig()
    13  	if err := c.Prepare(nil); err == nil {
    14  		t.Fatalf("shouldn't have err: %s", err)
    15  	}
    16  }
    17  
    18  func TestAccessConfigPrepare_Region(t *testing.T) {
    19  	dfw := "DFW"
    20  	c := testAccessConfig()
    21  	c.RawRegion = dfw
    22  	if err := c.Prepare(nil); err != nil {
    23  		t.Fatalf("shouldn't have err: %s", err)
    24  	}
    25  	if dfw != c.Region() {
    26  		t.Fatalf("Regions do not match: %s %s", dfw, c.Region())
    27  	}
    28  }