2016-06-28 21:00:05 +00:00
|
|
|
package dnsmadeeasy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
testLive bool
|
|
|
|
testAPIKey string
|
|
|
|
testAPISecret string
|
|
|
|
testDomain string
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
testAPIKey = os.Getenv("DNSMADEEASY_API_KEY")
|
|
|
|
testAPISecret = os.Getenv("DNSMADEEASY_API_SECRET")
|
|
|
|
testDomain = os.Getenv("DNSMADEEASY_DOMAIN")
|
|
|
|
os.Setenv("DNSMADEEASY_SANDBOX", "true")
|
|
|
|
testLive = len(testAPIKey) > 0 && len(testAPISecret) > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPresentAndCleanup(t *testing.T) {
|
|
|
|
if !testLive {
|
|
|
|
t.Skip("skipping live test")
|
|
|
|
}
|
|
|
|
|
|
|
|
provider, err := NewDNSProvider()
|
2018-05-30 17:53:04 +00:00
|
|
|
assert.NoError(t, err)
|
2016-06-28 21:00:05 +00:00
|
|
|
|
|
|
|
err = provider.Present(testDomain, "", "123d==")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
err = provider.CleanUp(testDomain, "", "123d==")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
}
|