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