Skip to content

Commit

Permalink
solve get env
Browse files Browse the repository at this point in the history
  • Loading branch information
allan committed Jul 25, 2024
1 parent 4e7865d commit 891d828
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
23 changes: 17 additions & 6 deletions test/a_main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
6 changes: 5 additions & 1 deletion tiktok/resty.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package tiktok

import (
"fmt"

"github.com/go-resty/resty/v2"
)

func (o *tiktok) HealthCheck() error {
resp, err := o.restyPost("/", nil)
Expand Down Expand Up @@ -41,4 +45,4 @@ func (o *tiktok) restyGet(url string, queryParams map[string]string) (*resty.Res
return nil, err
}
return resp, nil
}
}

0 comments on commit 891d828

Please sign in to comment.