Skip to content

Commit

Permalink
Allow for DNSimple User API tokens to be used by implementing the DNS…
Browse files Browse the repository at this point in the history
…IMPLE_ACCOUNT_ID and DNSIMPLE_ZONES environment variables

Update tests to check that the BuildDnsimpleProvider function (called by the NewDnsimpleProvider function) handles the DNSIMPLE_ACCOUNT_ID environment variable properly
  • Loading branch information
IntegralProgrammer committed Feb 26, 2024
1 parent 3babcbc commit acf188f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions provider/dnsimple/dnsimple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ func TestNewDnsimpleProvider(t *testing.T) {
if err == nil {
t.Errorf("Expected to fail new provider on empty token")
}

os.Setenv("DNSIMPLE_OAUTH", "xxxxxxxxxxxxxxxxxxxxxxxxxx")
os.Setenv("DNSIMPLE_ACCOUNT_ID", "12345678")
builtProvider, err := BuildDnsimpleProvider(endpoint.NewDomainFilter([]string{"example.com"}), provider.NewZoneIDFilter([]string{""}), true, true)
if err != nil {
t.Errorf("Unexpected error thrown when testing BuildDnsimpleProvider with the DNSIMPLE_ACCOUNT_ID environment variable set")
}
assert.Equal(t, builtProvider.accountID, "12345678")
os.Unsetenv("DNSIMPLE_OAUTH")
os.Unsetenv("DNSIMPLE_ACCOUNT_ID")
}

func testDnsimpleGetRecordID(t *testing.T) {
Expand Down

0 comments on commit acf188f

Please sign in to comment.