Gandi DNS: Unexport Endpoint variable

This commit is contained in:
Michael Cross 2016-03-21 18:47:17 +00:00
parent 4d8e4d3ec1
commit 6c2e92dd92
2 changed files with 6 additions and 8 deletions

View file

@ -179,10 +179,8 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
return 40 * time.Minute, 60 * time.Second return 40 * time.Minute, 60 * time.Second
} }
// Endpoint is the Gandi XML-RPC endpoint used by Present and // endpoint is the Gandi XML-RPC endpoint used by Present and CleanUp.
// CleanUp. It is exported only so it may be overridden during package var endpoint = "https://rpc.gandi.net/xmlrpc/"
// tests.
var Endpoint = "https://rpc.gandi.net/xmlrpc/"
// types for XML-RPC method calls and parameters // types for XML-RPC method calls and parameters
@ -297,7 +295,7 @@ func rpcCall(call *methodCall, resp response) error {
} }
// post // post
b = append([]byte(`<?xml version="1.0"?>`+"\n"), b...) b = append([]byte(`<?xml version="1.0"?>`+"\n"), b...)
respBody, err := httpPost(Endpoint, "text/xml", bytes.NewReader(b)) respBody, err := httpPost(endpoint, "text/xml", bytes.NewReader(b))
if err != nil { if err != nil {
return err return err
} }

View file

@ -45,11 +45,11 @@ func TestDNSProvider(t *testing.T) {
})) }))
defer fakeServer.Close() defer fakeServer.Close()
// override gandi endpoint to point to fake server // override gandi endpoint to point to fake server
savedEndpoint := Endpoint savedEndpoint := endpoint
defer func() { defer func() {
Endpoint = savedEndpoint endpoint = savedEndpoint
}() }()
Endpoint = fakeServer.URL + "/" endpoint = fakeServer.URL + "/"
// run Present // run Present
err = provider.Present("abc.def.example.com", "", fakeKeyAuth) err = provider.Present("abc.def.example.com", "", fakeKeyAuth)
if err != nil { if err != nil {