| 1 | package dnsmadeeasyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/ |
| 2 | |
| 3 | import ( |
| 4 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 6 | |
| 7 | "github.com/go-acme/lego/v4/platform/testerscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/" |
| 8 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 9 | ) |
| 10 | |
| 11 | const envDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envDomain. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envNamespace. + "DOMAIN" |
| 12 | |
| 13 | var envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest. = testerscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/.NewEnvTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/NewEnvTest().( |
| 14 | EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPIKey., |
| 15 | EnvAPISecretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPISecret.). |
| 16 | WithDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#WithDomain().(envDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envDomain.) |
| 17 | |
| 18 | func TestNewDNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/TestNewDNSProvider().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 19 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.Setenvscip-go gomod github.com/golang/go/src go1.25.0 os/Setenv().(EnvSandboxscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvSandbox., "true") |
| 20 | |
| 21 | testCases := []struct { |
| 22 | desc string |
| 23 | envVars map[string]string |
| 24 | expected string |
| 25 | }{ |
| 26 | { |
| 27 | desc: "success", |
| 28 | envVars: map[string]string{ |
| 29 | EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPIKey.: "123", |
| 30 | EnvAPISecretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPISecret.: "456", |
| 31 | }, |
| 32 | }, |
| 33 | { |
| 34 | desc: "missing credentials", |
| 35 | envVars: map[string]string{ |
| 36 | EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPIKey.: "", |
| 37 | EnvAPISecretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPISecret.: "", |
| 38 | }, |
| 39 | expected: "dnsmadeeasy: some credentials information are missing: DNSMADEEASY_API_KEY,DNSMADEEASY_API_SECRET", |
| 40 | }, |
| 41 | { |
| 42 | desc: "missing access key", |
| 43 | envVars: map[string]string{ |
| 44 | EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPIKey.: "", |
| 45 | EnvAPISecretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPISecret.: "456", |
| 46 | }, |
| 47 | expected: "dnsmadeeasy: some credentials information are missing: DNSMADEEASY_API_KEY", |
| 48 | }, |
| 49 | { |
| 50 | desc: "missing secret key", |
| 51 | envVars: map[string]string{ |
| 52 | EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPIKey.: "123", |
| 53 | EnvAPISecretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvAPISecret.: "", |
| 54 | }, |
| 55 | expected: "dnsmadeeasy: some credentials information are missing: DNSMADEEASY_API_SECRET", |
| 56 | }, |
| 57 | } |
| 58 | |
| 59 | for _, test := range testCases { |
| 60 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(test.desc, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 61 | defer envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..RestoreEnvscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#RestoreEnv().() |
| 62 | |
| 63 | envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..ClearEnvscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#ClearEnv().() |
| 64 | |
| 65 | envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..Applyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#Apply().(test.envVars) |
| 66 | |
| 67 | p, err := NewDNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/NewDNSProvider().() |
| 68 | |
| 69 | if test.expected == "" { |
| 70 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 71 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, p) |
| 72 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, p.configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/DNSProvider#config.) |
| 73 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, p.clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/DNSProvider#client.) |
| 74 | } else { |
| 75 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/EqualError().(t, err, test.expected) |
| 76 | } |
| 77 | }) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestNewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/TestNewDNSProviderConfig().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 82 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.Setenvscip-go gomod github.com/golang/go/src go1.25.0 os/Setenv().(EnvSandboxscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvSandbox., "true") |
| 83 | |
| 84 | testCases := []struct { |
| 85 | desc string |
| 86 | apiKey string |
| 87 | apiSecret string |
| 88 | expected string |
| 89 | }{ |
| 90 | { |
| 91 | desc: "success", |
| 92 | apiKey: "123", |
| 93 | apiSecret: "456", |
| 94 | }, |
| 95 | { |
| 96 | desc: "missing credentials", |
| 97 | expected: "dnsmadeeasy: credentials missing: API key", |
| 98 | }, |
| 99 | { |
| 100 | desc: "missing api key", |
| 101 | apiSecret: "456", |
| 102 | expected: "dnsmadeeasy: credentials missing: API key", |
| 103 | }, |
| 104 | { |
| 105 | desc: "missing secret key", |
| 106 | apiKey: "123", |
| 107 | expected: "dnsmadeeasy: credentials missing: API secret", |
| 108 | }, |
| 109 | } |
| 110 | |
| 111 | for _, test := range testCases { |
| 112 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(test.desc, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 113 | config := NewDefaultConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/NewDefaultConfig().() |
| 114 | config.APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/Config#APIKey. = test.apiKey |
| 115 | config.APISecretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/Config#APISecret. = test.apiSecret |
| 116 | |
| 117 | p, err := NewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/NewDNSProviderConfig().(config) |
| 118 | |
| 119 | if test.expected == "" { |
| 120 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 121 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, p) |
| 122 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, p.configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/DNSProvider#config.) |
| 123 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, p.clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/DNSProvider#client.) |
| 124 | } else { |
| 125 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/EqualError().(t, err, test.expected) |
| 126 | } |
| 127 | }) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | func TestLivePresentAndCleanupscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/TestLivePresentAndCleanup().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 132 | if !envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..IsLiveTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#IsLiveTest().() { |
| 133 | t.Skipscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skip().("skipping live test") |
| 134 | } |
| 135 | |
| 136 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.Setenvscip-go gomod github.com/golang/go/src go1.25.0 os/Setenv().(EnvSandboxscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/EnvSandbox., "true") |
| 137 | |
| 138 | envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..RestoreEnvscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#RestoreEnv().() |
| 139 | |
| 140 | provider, err := NewDNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/NewDNSProvider().() |
| 141 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 142 | |
| 143 | err = provider.Presentscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/DNSProvider#Present().(envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..GetDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#GetDomain().(), "", "123d==") |
| 144 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 145 | |
| 146 | err = provider.CleanUpscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/DNSProvider#CleanUp().(envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy`/envTest..GetDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#GetDomain().(), "", "123d==") |
| 147 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 148 | } |