github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/dme/provider_test.go (about)

     1  package dme
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/schema"
     8  	"github.com/hashicorp/terraform/terraform"
     9  )
    10  
    11  var testAccProviders map[string]terraform.ResourceProvider
    12  var testAccProvider *schema.Provider
    13  
    14  func init() {
    15  	testAccProvider = Provider().(*schema.Provider)
    16  	testAccProviders = map[string]terraform.ResourceProvider{
    17  		// provider is called terraform-provider-dme ie dme
    18  		"dme": testAccProvider,
    19  	}
    20  }
    21  
    22  func TestProvider(t *testing.T) {
    23  	if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
    24  		t.Fatalf("err: %s", err)
    25  	}
    26  }
    27  
    28  func TestProviderImpl(t *testing.T) {
    29  	var _ terraform.ResourceProvider = Provider()
    30  }
    31  
    32  func testAccPreCheck(t *testing.T) {
    33  	if v := os.Getenv("DME_SKEY"); v == "" {
    34  		t.Fatal("DME_SKEY must be set for acceptance tests")
    35  	}
    36  
    37  	if v := os.Getenv("DME_AKEY"); v == "" {
    38  		t.Fatal("DME_AKEY must be set for acceptance tests")
    39  	}
    40  
    41  	if v := os.Getenv("DME_DOMAINID"); v == "" {
    42  		t.Fatal("DME_DOMAINID must be set for acceptance tests")
    43  	}
    44  
    45  	if v := os.Getenv("DME_USESANDBOX"); v == "" {
    46  		t.Fatal("DME_USESANDBOX must be set for acceptance tests. Use the strings 'true' or 'false'.")
    47  	}
    48  }