github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/scaleway/provider_test.go (about)

     1  package scaleway
     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  		"scaleway": testAccProvider,
    18  	}
    19  }
    20  
    21  func TestProvider(t *testing.T) {
    22  	if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
    23  		t.Fatalf("err: %s", err)
    24  	}
    25  }
    26  
    27  func TestProvider_impl(t *testing.T) {
    28  	var _ terraform.ResourceProvider = Provider()
    29  }
    30  
    31  func testAccPreCheck(t *testing.T) {
    32  	if v := os.Getenv("SCALEWAY_ORGANIZATION"); v == "" {
    33  		t.Fatal("SCALEWAY_ORGANIZATION must be set for acceptance tests")
    34  	}
    35  	tokenFromAccessKey := os.Getenv("SCALEWAY_ACCESS_KEY")
    36  	token := os.Getenv("SCALEWAY_TOKEN")
    37  	if token == "" && tokenFromAccessKey == "" {
    38  		t.Fatal("SCALEWAY_TOKEN must be set for acceptance tests")
    39  	}
    40  }