diff --git a/test/a_main_test.go b/test/a_main_test.go index ce1e24d..4ada9b1 100644 --- a/test/a_main_test.go +++ b/test/a_main_test.go @@ -3,25 +3,36 @@ package test import ( "os" "testing" - "github.com/HiWay-Media/tiktok-go-sdk/tiktok" + + "github.com/HiWay-Media/tiktok-go-sdk/tiktok" ) func TestMain(m *testing.M) { - c, err := GetTikTok() + if os.Getenv("APP_ENV") == "" { + err := os.Setenv("APP_ENV", "test") + if err != nil { + panic("could not set test env") + } + } + //env.Load() + m.Run() +} + +func TestNewCompress(t *testing.T) { + c, err := GetTikTok() if err != nil { t.Fatalf(err.Error()) } c.IsDebug() } - func GetTikTok() (tiktok.ITiktok, error) { - clientKey := os.GetEnv("clientKey") - clientSecret := os.GetEnv("clientSecret") + clientKey := os.Getenv("clientKey") + clientSecret := os.Getenv("clientSecret") // c, err := tiktok.NewTikTok(clientKey, clientSecret, false) if err != nil { return nil, err } return c, nil -} \ No newline at end of file +} diff --git a/tiktok/resty.go b/tiktok/resty.go index 45e44fb..f9aee80 100644 --- a/tiktok/resty.go +++ b/tiktok/resty.go @@ -1,6 +1,10 @@ package tiktok +import ( + "fmt" + "github.com/go-resty/resty/v2" +) func (o *tiktok) HealthCheck() error { resp, err := o.restyPost("/", nil) @@ -41,4 +45,4 @@ func (o *tiktok) restyGet(url string, queryParams map[string]string) (*resty.Res return nil, err } return resp, nil -} \ No newline at end of file +}