lego/providers/dns/namedotcom/namedotcom_test.go
Ludovic Fernandez bba134ce87
Allow to configure TTL, interval and timeout (#634)
* feat: add GetOrDefaultXXX methods.
* refactor: configuration (alidns).
* refactor: configuration (azure).
* refactor: configuration (auroradns).
* refactor: configuration (bluecat).
* refactor: configuration (cloudflare).
* refactor: configuration (digitalocean).
* refactor: configuration (dnsimple).
* refactor: configuration (dnmadeeasy).
* refactor: configuration (dnspod).
* refactor: configuration (duckdns).
* refactor: configuration (dyn).
* refactor: configuration (exoscale).
* refactor: configuration (fastdns).
* refactor: configuration (gandi).
* refactor: configuration (gandiv5).
* refactor: configuration (gcloud).
* refactor: configuration (glesys).
* refactor: configuration (godaddy).
* refactor: configuration (iij).
* refactor: configuration (lightsail).
* refactor: configuration (linode).
* refactor: configuration (namecheap).
* refactor: configuration (namedotcom).
* refactor: configuration (netcup).
* refactor: configuration (nifcloud).
* refactor: configuration (ns1).
* refactor: configuration (otc).
* refactor: configuration (ovh).
* refactor: configuration (pdns).
* refactor: configuration (rackspace).
* refactor: configuration (rfc2136).
* refactor: configuration (route53).
* refactor: configuration (sakuracloud).
* refactor: configuration (vegadns).
* refactor: configuration (vultr).
2018-09-15 19:07:24 +02:00

68 lines
1.4 KiB
Go

package namedotcom
import (
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
var (
namedotcomLiveTest bool
namedotcomUsername string
namedotcomAPIToken string
namedotcomDomain string
namedotcomServer string
)
func init() {
namedotcomUsername = os.Getenv("NAMEDOTCOM_USERNAME")
namedotcomAPIToken = os.Getenv("NAMEDOTCOM_API_TOKEN")
namedotcomDomain = os.Getenv("NAMEDOTCOM_DOMAIN")
namedotcomServer = os.Getenv("NAMEDOTCOM_SERVER")
if len(namedotcomAPIToken) > 0 && len(namedotcomUsername) > 0 && len(namedotcomDomain) > 0 {
namedotcomLiveTest = true
}
}
func TestLiveNamedotcomPresent(t *testing.T) {
if !namedotcomLiveTest {
t.Skip("skipping live test")
}
config := NewDefaultConfig()
config.Username = namedotcomUsername
config.APIToken = namedotcomAPIToken
config.Server = namedotcomServer
provider, err := NewDNSProviderConfig(config)
assert.NoError(t, err)
err = provider.Present(namedotcomDomain, "", "123d==")
assert.NoError(t, err)
}
//
// Cleanup
//
func TestLiveNamedotcomCleanUp(t *testing.T) {
if !namedotcomLiveTest {
t.Skip("skipping live test")
}
time.Sleep(time.Second * 1)
config := NewDefaultConfig()
config.Username = namedotcomUsername
config.APIToken = namedotcomAPIToken
config.Server = namedotcomServer
provider, err := NewDNSProviderConfig(config)
assert.NoError(t, err)
err = provider.CleanUp(namedotcomDomain, "", "123d==")
assert.NoError(t, err)
}