| 1 | package namecheapscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/ |
| 2 | |
| 3 | import ( |
| 4 | "net/http/httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 6 | |
| 7 | "github.com/go-acme/lego/v4/platform/tester/servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/" |
| 8 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 9 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 10 | ) |
| 11 | |
| 12 | const ( |
| 13 | envTestUserscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/envTestUser. = "foo" |
| 14 | envTestKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/envTestKey. = "bar" |
| 15 | envTestClientIPscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/envTestClientIP. = "10.0.0.1" |
| 16 | ) |
| 17 | |
| 18 | type testCasescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase# struct { |
| 19 | namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#name. string |
| 20 | domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain. string |
| 21 | errStringscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#errString. string |
| 22 | getHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#getHostsResponse. string |
| 23 | setHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#setHostsResponse. string |
| 24 | } |
| 25 | |
| 26 | var testCasesscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCases. = []testCasescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#{ |
| 27 | { |
| 28 | namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#name.: "Test:Success:1", |
| 29 | domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain.: "test.example.com", |
| 30 | getHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#getHostsResponse.: "getHosts_success1.xml", |
| 31 | setHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#setHostsResponse.: "setHosts_success1.xml", |
| 32 | }, |
| 33 | { |
| 34 | namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#name.: "Test:Success:2", |
| 35 | domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain.: "example.com", |
| 36 | getHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#getHostsResponse.: "getHosts_success2.xml", |
| 37 | setHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#setHostsResponse.: "setHosts_success2.xml", |
| 38 | }, |
| 39 | { |
| 40 | namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#name.: "Test:Error:BadApiKey:1", |
| 41 | domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain.: "test.example.com", |
| 42 | errStringscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#errString.: "API Key is invalid or API access has not been enabled [1011102]", |
| 43 | getHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#getHostsResponse.: "getHosts_errorBadAPIKey1.xml", |
| 44 | }, |
| 45 | } |
| 46 | |
| 47 | func TestDNSProvider_Presentscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/TestDNSProvider_Present().(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#) { |
| 48 | for _, test := range testCasesscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCases. { |
| 49 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(test.namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#name., 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#) { |
| 50 | ch, _ := newPseudoRecordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/newPseudoRecord().(test.domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain., "") |
| 51 | |
| 52 | provider := mockBuilderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/mockBuilder().(). |
| 53 | Routescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#Route().("GET /", |
| 54 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.ResponseFromInternalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/ResponseFromInternal().(test.getHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#getHostsResponse.), |
| 55 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.CheckFormscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/CheckForm().().Strictscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#Strict().(). |
| 56 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ClientIp", "10.0.0.1"). |
| 57 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("Command", "namecheap.domains.dns.getHosts"). |
| 58 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("SLD", ch.sldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#sld.). |
| 59 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("TLD", ch.tldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#tld.). |
| 60 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("UserName", "foo"). |
| 61 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiKey", "bar"). |
| 62 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiUser", "foo"), |
| 63 | ). |
| 64 | Routescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#Route().("POST /", |
| 65 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.ResponseFromInternalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/ResponseFromInternal().(test.setHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#setHostsResponse.), |
| 66 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.CheckFormscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/CheckForm().(). |
| 67 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ClientIp", "10.0.0.1"). |
| 68 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("Command", "namecheap.domains.dns.setHosts"). |
| 69 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("SLD", ch.sldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#sld.). |
| 70 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("TLD", ch.tldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#tld.). |
| 71 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("UserName", "foo"). |
| 72 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiKey", "bar"). |
| 73 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiUser", "foo"), |
| 74 | ). |
| 75 | Buildscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#Build().(t) |
| 76 | |
| 77 | err := provider.Presentscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/DNSProvider#Present().(test.domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain., "", "dummyKey") |
| 78 | if test.errStringscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#errString. != "" { |
| 79 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualError().(t, err, "namecheap: "+test.errStringscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#errString.) |
| 80 | } else { |
| 81 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 82 | } |
| 83 | }) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | func TestDNSProvider_CleanUpscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/TestDNSProvider_CleanUp().(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#) { |
| 88 | for _, test := range testCasesscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCases. { |
| 89 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(test.namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#name., 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#) { |
| 90 | ch, _ := newPseudoRecordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/newPseudoRecord().(test.domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain., "") |
| 91 | |
| 92 | provider := mockBuilderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/mockBuilder().(). |
| 93 | Routescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#Route().("GET /", |
| 94 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.ResponseFromInternalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/ResponseFromInternal().(test.getHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#getHostsResponse.), |
| 95 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.CheckFormscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/CheckForm().().Strictscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#Strict().(). |
| 96 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ClientIp", "10.0.0.1"). |
| 97 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("Command", "namecheap.domains.dns.getHosts"). |
| 98 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("SLD", ch.sldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#sld.). |
| 99 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("TLD", ch.tldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#tld.). |
| 100 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("UserName", "foo"). |
| 101 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiKey", "bar"). |
| 102 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiUser", "foo"), |
| 103 | ). |
| 104 | Routescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#Route().("POST /", |
| 105 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.ResponseFromInternalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/ResponseFromInternal().(test.setHostsResponsescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#setHostsResponse.), |
| 106 | servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.CheckFormscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/CheckForm().(). |
| 107 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ClientIp", "10.0.0.1"). |
| 108 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("Command", "namecheap.domains.dns.setHosts"). |
| 109 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("SLD", ch.sldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#sld.). |
| 110 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("TLD", ch.tldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#tld.). |
| 111 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("UserName", "foo"). |
| 112 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiKey", "bar"). |
| 113 | Withscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/FormLink#With().("ApiUser", "foo"), |
| 114 | ). |
| 115 | Buildscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#Build().(t) |
| 116 | |
| 117 | err := provider.CleanUpscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/DNSProvider#CleanUp().(test.domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#domain., "", "dummyKey") |
| 118 | if test.errStringscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#errString. != "" { |
| 119 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualError().(t, err, "namecheap: "+test.errStringscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/testCase#errString.) |
| 120 | } else { |
| 121 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 122 | } |
| 123 | }) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | func Test_newPseudoRecord_domainSplitscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/Test_newPseudoRecord_domainSplit().(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#) { |
| 128 | tests := []struct { |
| 129 | domain string |
| 130 | valid bool |
| 131 | tld string |
| 132 | sld string |
| 133 | host string |
| 134 | }{ |
| 135 | {domain: "a.b.c.test.co.uk", valid: true, tld: "co.uk", sld: "test", host: "a.b.c"}, |
| 136 | {domain: "test.co.uk", valid: true, tld: "co.uk", sld: "test"}, |
| 137 | {domain: "test.com", valid: true, tld: "com", sld: "test"}, |
| 138 | {domain: "test.co.com", valid: true, tld: "co.com", sld: "test"}, |
| 139 | {domain: "www.test.com.au", valid: true, tld: "com.au", sld: "test", host: "www"}, |
| 140 | {domain: "www.za.com", valid: true, tld: "za.com", sld: "www"}, |
| 141 | {domain: "my.test.tf", valid: true, tld: "tf", sld: "test", host: "my"}, |
| 142 | {}, |
| 143 | {domain: "a"}, |
| 144 | {domain: "com"}, |
| 145 | {domain: "com.au"}, |
| 146 | {domain: "co.com"}, |
| 147 | {domain: "co.uk"}, |
| 148 | {domain: "tf"}, |
| 149 | {domain: "za.com"}, |
| 150 | } |
| 151 | |
| 152 | for _, test := range tests { |
| 153 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(test.domain, 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#) { |
| 154 | valid := true |
| 155 | |
| 156 | ch, err := newPseudoRecordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/newPseudoRecord().(test.domain, "") |
| 157 | if err != nil { |
| 158 | valid = false |
| 159 | } |
| 160 | |
| 161 | if test.valid && !valid { |
| 162 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("Expected '%s' to split", test.domain) |
| 163 | } else if !test.valid && valid { |
| 164 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("Expected '%s' to produce error", test.domain) |
| 165 | } |
| 166 | |
| 167 | if test.valid && valid { |
| 168 | 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, ch) |
| 169 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test.domain, ch.domainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#domain., "domain") |
| 170 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test.tld, ch.tldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#tld., "tld") |
| 171 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test.sld, ch.sldscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#sld., "sld") |
| 172 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test.host, ch.hostscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/pseudoRecord#host., "host") |
| 173 | } |
| 174 | }) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | func mockBuilderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/mockBuilder().() *servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.Builderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/Builder#[*DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/DNSProvider#] { |
| 179 | return servermockscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/.NewBuilderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester/servermock`/NewBuilder().(func(server *httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.Serverscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#) (*DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/DNSProvider#, error) { |
| 180 | config := NewDefaultConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/NewDefaultConfig().() |
| 181 | config.HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/Config#HTTPClient. = server.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Client().() |
| 182 | config.BaseURLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/Config#BaseURL. = server.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL. |
| 183 | config.APIUserscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/Config#APIUser. = envTestUserscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/envTestUser. |
| 184 | config.APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/Config#APIKey. = envTestKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/envTestKey. |
| 185 | config.ClientIPscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/Config#ClientIP. = envTestClientIPscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/envTestClientIP. |
| 186 | |
| 187 | return NewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/namecheap`/NewDNSProviderConfig().(config) |
| 188 | }) |
| 189 | } |