From 6b072fc618d068eacee15e3cabdc1e72e4128176 Mon Sep 17 00:00:00 2001 From: Allan Nava Date: Fri, 26 Jul 2024 11:05:33 +0200 Subject: [PATCH] added tests --- test/a_main_test.go | 2 +- test/api_content_test.go | 20 ++++++++++++++++++++ tiktok/tiktok.go | 10 +++++----- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 test/api_content_test.go diff --git a/test/a_main_test.go b/test/a_main_test.go index fb641a9..f6f0076 100644 --- a/test/a_main_test.go +++ b/test/a_main_test.go @@ -23,7 +23,7 @@ func TestNewTikTok(t *testing.T) { if err != nil { t.Fatalf(err.Error()) } - c.IsDebug() + log.Println(c.IsDebug()) } func GetTikTok() (tiktok.ITiktok, error) { diff --git a/test/api_content_test.go b/test/api_content_test.go new file mode 100644 index 0000000..2c21444 --- /dev/null +++ b/test/api_content_test.go @@ -0,0 +1,20 @@ +package test + +import ( + "os" + "testing" + + "github.com/HiWay-Media/tiktok-go-sdk/tiktok" +) + +func Test(t *testing.T) { + c, err := GetTikTok() + if err != nil { + t.Fatalf(err.Error()) + } + resp , err := c.CreatorInfo() + if err != nil { + t.Fatalf(err.Error()) + } + log.Println("resp ", resp) +} \ No newline at end of file diff --git a/tiktok/tiktok.go b/tiktok/tiktok.go index 00c3eac..4b81caf 100644 --- a/tiktok/tiktok.go +++ b/tiktok/tiktok.go @@ -13,11 +13,11 @@ type ITiktok interface { } type tiktok struct { - restClient *resty.Client - debug bool - clientKey string - clientSecret string - accessToken string + restClient *resty.Client + debug bool + clientKey string + clientSecret string + accessToken string } func NewTikTok(clientKey, clientSecret string, isDebug bool) (ITiktok, error) {