mirror of https://github.com/hashicorp/terraform
provider/pagerduty: Validate credentials (#12854)
* Validate credentials * Add ability to skip validation * Update provider documentation * invalidCredentials -> invalidCreds * Include original error message * Update description for skip_credentials_validation * Add config test * set skip_credentials_validation default to falsepull/12629/head
parent
4759b51132
commit
ca517543f2
@ -0,0 +1,28 @@
|
||||
package pagerduty
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Test config with an empty token
|
||||
func TestConfigEmptyToken(t *testing.T) {
|
||||
config := Config{
|
||||
Token: "",
|
||||
}
|
||||
|
||||
if _, err := config.Client(); err == nil {
|
||||
t.Fatalf("expected error, but got nil")
|
||||
}
|
||||
}
|
||||
|
||||
// Test config with invalid token but with SkipCredsValidation
|
||||
func TestConfigSkipCredsValidation(t *testing.T) {
|
||||
config := Config{
|
||||
Token: "foo",
|
||||
SkipCredsValidation: true,
|
||||
}
|
||||
|
||||
if _, err := config.Client(); err != nil {
|
||||
t.Fatalf("error: expected the client to not fail: %v", err)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue