Allow for DNSimple User API tokens to be used by implementing the DNSIMPLE_ACCOUNT_ID and DNSIMPLE_ZONES environment variables

Update tests to check that the dnsimpleSuitableZone function works properly when the DNSIMPLE_ZONES environment variable is set
This commit is contained in:
Michael Lescisin 2024-02-26 11:37:56 -05:00
parent 26694e4b26
commit d0c121b97c

View File

@ -227,6 +227,17 @@ func testDnsimpleSuitableZone(t *testing.T) {
zone := dnsimpleSuitableZone("example-beta.example.com", zones)
assert.Equal(t, zone.Name, "example.com")
os.Setenv("DNSIMPLE_ZONES", "environment-example.com,example.environment-example.com")
mockProvider.accountID = "3"
zones, err = mockProvider.Zones(ctx)
assert.Nil(t, err)
zone = dnsimpleSuitableZone("hello.example.environment-example.com", zones)
assert.Equal(t, zone.Name, "example.environment-example.com")
os.Unsetenv("DNSIMPLE_ZONES")
mockProvider.accountID = "1"
}
func TestNewDnsimpleProvider(t *testing.T) {