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

     1  package pagerduty
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  // Test config with an empty token
     8  func TestConfigEmptyToken(t *testing.T) {
     9  	config := Config{
    10  		Token: "",
    11  	}
    12  
    13  	if _, err := config.Client(); err == nil {
    14  		t.Fatalf("expected error, but got nil")
    15  	}
    16  }
    17  
    18  // Test config with invalid token but with SkipCredsValidation
    19  func TestConfigSkipCredsValidation(t *testing.T) {
    20  	config := Config{
    21  		Token:               "foo",
    22  		SkipCredsValidation: true,
    23  	}
    24  
    25  	if _, err := config.Client(); err != nil {
    26  		t.Fatalf("error: expected the client to not fail: %v", err)
    27  	}
    28  }