| 1 | package active24scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/active24`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 5 | |
| 6 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 7 | ) |
| 8 | |
| 9 | func TestNewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/active24`/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#) { |
| 10 | testCases := []struct { |
| 11 | desc string |
| 12 | apiKey string |
| 13 | secret string |
| 14 | expected string |
| 15 | }{ |
| 16 | { |
| 17 | desc: "success", |
| 18 | apiKey: "user", |
| 19 | secret: "secret", |
| 20 | }, |
| 21 | { |
| 22 | desc: "missing API key", |
| 23 | apiKey: "", |
| 24 | secret: "secret", |
| 25 | expected: "credentials missing", |
| 26 | }, |
| 27 | { |
| 28 | desc: "missing secret", |
| 29 | apiKey: "user", |
| 30 | secret: "", |
| 31 | expected: "credentials missing", |
| 32 | }, |
| 33 | { |
| 34 | desc: "missing credentials", |
| 35 | expected: "credentials missing", |
| 36 | }, |
| 37 | } |
| 38 | |
| 39 | for _, test := range testCases { |
| 40 | 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#) { |
| 41 | config := &Configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/active24`/Config#{} |
| 42 | config.APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/active24`/Config#APIKey. = test.apiKey |
| 43 | config.Secretscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/active24`/Config#Secret. = test.secret |
| 44 | |
| 45 | p, err := NewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/active24`/NewDNSProviderConfig().(config, "example.com") |
| 46 | |
| 47 | if test.expected == "" { |
| 48 | 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) |
| 49 | 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) |
| 50 | 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/internal/active24`/DNSProvider#config.) |
| 51 | 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/internal/active24`/DNSProvider#client.) |
| 52 | } else { |
| 53 | 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) |
| 54 | } |
| 55 | }) |
| 56 | } |
| 57 | } |