github.com/jrperritt/terraform@v0.1.1-0.20170525065507-96f391dafc38/builtin/providers/github/provider_test.go (about)

     1  package github
     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 testUser string = os.Getenv("GITHUB_TEST_USER")
    12  var testCollaborator string = os.Getenv("GITHUB_TEST_COLLABORATOR")
    13  
    14  var testAccProviders map[string]terraform.ResourceProvider
    15  var testAccProvider *schema.Provider
    16  
    17  func init() {
    18  	testAccProvider = Provider().(*schema.Provider)
    19  	testAccProviders = map[string]terraform.ResourceProvider{
    20  		"github": testAccProvider,
    21  	}
    22  }
    23  
    24  func TestProvider(t *testing.T) {
    25  	if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
    26  		t.Fatalf("err: %s", err)
    27  	}
    28  }
    29  
    30  func TestProvider_impl(t *testing.T) {
    31  	var _ terraform.ResourceProvider = Provider()
    32  }
    33  
    34  func testAccPreCheck(t *testing.T) {
    35  	if v := os.Getenv("GITHUB_TOKEN"); v == "" {
    36  		t.Fatal("GITHUB_TOKEN must be set for acceptance tests")
    37  	}
    38  	if v := os.Getenv("GITHUB_ORGANIZATION"); v == "" {
    39  		t.Fatal("GITHUB_ORGANIZATION must be set for acceptance tests")
    40  	}
    41  	if v := os.Getenv("GITHUB_TEST_USER"); v == "" {
    42  		t.Fatal("GITHUB_TEST_USER must be set for acceptance tests")
    43  	}
    44  	if v := os.Getenv("GITHUB_TEST_COLLABORATOR"); v == "" {
    45  		t.Fatal("GITHUB_TEST_COLLABORATOR must be set for acceptance tests")
    46  	}
    47  }