terraform/builtin/providers/aws/resource_provider_test.go

44 lines
806 B
Go
Raw Normal View History

2014-05-30 02:28:38 +02:00
package aws
import (
2014-06-24 04:01:57 +02:00
"reflect"
2014-05-30 02:28:38 +02:00
"testing"
2014-06-24 04:01:57 +02:00
"github.com/hashicorp/terraform/config"
2014-05-30 02:28:38 +02:00
"github.com/hashicorp/terraform/terraform"
)
func TestResourceProvider_impl(t *testing.T) {
var _ terraform.ResourceProvider = new(ResourceProvider)
}
2014-06-24 04:01:57 +02:00
func TestResourceProvider_Configure(t *testing.T) {
rp := new(ResourceProvider)
raw := map[string]interface{}{
"access_key": "foo",
"secret_key": "bar",
"region": "us-east",
}
rawConfig, err := config.NewRawConfig(raw)
if err != nil {
t.Fatalf("err: %s", err)
}
err = rp.Configure(terraform.NewResourceConfig(rawConfig))
if err != nil {
t.Fatalf("err: %s", err)
}
expected := Config{
AccessKey: "foo",
SecretKey: "bar",
Region: "us-east",
}
if !reflect.DeepEqual(rp.Config, expected) {
t.Fatalf("bad: %#v", rp.Config)
}
}