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