forked from TrueCloudLab/lego
ad20bf90ff
* refactor: linting. - errcheck - govet - golint - goconst - spellcheck - ... * refactor: migrate from gometalinter to golangci-lint.
52 lines
1 KiB
Go
52 lines
1 KiB
Go
package nifcloud
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
var (
|
|
nifcloudLiveTest bool
|
|
nifcloudAccessKey string
|
|
nifcloudSecretKey string
|
|
nifcloudDomain string
|
|
)
|
|
|
|
func init() {
|
|
nifcloudAccessKey = os.Getenv("NIFCLOUD_ACCESS_KEY_ID")
|
|
nifcloudSecretKey = os.Getenv("NIFCLOUD_SECRET_ACCESS_KEY")
|
|
nifcloudDomain = os.Getenv("NIFCLOUD_DOMAIN")
|
|
|
|
if len(nifcloudAccessKey) > 0 && len(nifcloudSecretKey) > 0 && len(nifcloudDomain) > 0 {
|
|
nifcloudLiveTest = true
|
|
}
|
|
}
|
|
|
|
func TestLivenifcloudPresent(t *testing.T) {
|
|
if !nifcloudLiveTest {
|
|
t.Skip("skipping live test")
|
|
}
|
|
|
|
provider, err := NewDNSProvider()
|
|
require.NoError(t, err)
|
|
|
|
err = provider.Present(nifcloudDomain, "", "123d==")
|
|
require.NoError(t, err)
|
|
}
|
|
|
|
func TestLivenifcloudCleanUp(t *testing.T) {
|
|
if !nifcloudLiveTest {
|
|
t.Skip("skipping live test")
|
|
}
|
|
|
|
time.Sleep(time.Second * 1)
|
|
|
|
provider, err := NewDNSProvider()
|
|
require.NoError(t, err)
|
|
|
|
err = provider.CleanUp(nifcloudDomain, "", "123d==")
|
|
require.NoError(t, err)
|
|
}
|