diff --git a/tests/Feature/Services/Social/TikTokCreatorInfoTest.php b/tests/Feature/Services/Social/TikTokCreatorInfoTest.php index 15ad23a9..f12bed08 100644 --- a/tests/Feature/Services/Social/TikTokCreatorInfoTest.php +++ b/tests/Feature/Services/Social/TikTokCreatorInfoTest.php @@ -17,11 +17,13 @@ ]); $this->service = new TikTokCreatorInfo; + + $this->api = config('trypost.platforms.tiktok.api'); }); test('it returns full creator payload from api response', function () { Http::fake([ - 'https://open.tiktokapis.com/v2/post/publish/creator_info/query/' => Http::response([ + $this->api.'/post/publish/creator_info/query/' => Http::response([ 'data' => [ 'creator_nickname' => 'Paulo', 'creator_username' => 'paulocastellano', @@ -49,7 +51,7 @@ test('it returns an empty payload when the api fails', function () { Http::fake([ - 'https://open.tiktokapis.com/v2/post/publish/creator_info/query/' => Http::response(['error' => 'unauthorized'], 401), + $this->api.'/post/publish/creator_info/query/' => Http::response(['error' => 'unauthorized'], 401), ]); $info = $this->service->fetch($this->account); @@ -66,12 +68,12 @@ $this->account->update(['token_expires_at' => now()->subMinute()]); Http::fake([ - 'https://open.tiktokapis.com/v2/oauth/token/' => Http::response([ + $this->api.'/oauth/token/' => Http::response([ 'access_token' => 'new-token', 'refresh_token' => 'new-refresh', 'expires_in' => 3600, ], 200), - 'https://open.tiktokapis.com/v2/post/publish/creator_info/query/' => Http::response([ + $this->api.'/post/publish/creator_info/query/' => Http::response([ 'data' => [ 'privacy_level_options' => ['PUBLIC_TO_EVERYONE'], ], diff --git a/tests/Unit/Exceptions/Social/TikTokPublishExceptionTest.php b/tests/Unit/Exceptions/Social/TikTokPublishExceptionTest.php index b852e218..c05d8135 100644 --- a/tests/Unit/Exceptions/Social/TikTokPublishExceptionTest.php +++ b/tests/Unit/Exceptions/Social/TikTokPublishExceptionTest.php @@ -16,7 +16,7 @@ ], ], 429); - $fakeResponse = Http::fake(['*' => $response])->post('https://open.tiktokapis.com/test'); + $fakeResponse = Http::fake(['*' => $response])->post(config('trypost.platforms.tiktok.api').'/test'); $exception = TikTokPublishException::fromApiResponse($fakeResponse); @@ -36,7 +36,7 @@ ], ], 401); - $fakeResponse = Http::fake(['*' => $response])->post('https://open.tiktokapis.com/test'); + $fakeResponse = Http::fake(['*' => $response])->post(config('trypost.platforms.tiktok.api').'/test'); TikTokPublishException::fromApiResponse($fakeResponse); })->throws(TokenExpiredException::class); @@ -50,7 +50,7 @@ ], ], 400); - $fakeResponse = Http::fake(['*' => $response])->post('https://open.tiktokapis.com/test'); + $fakeResponse = Http::fake(['*' => $response])->post(config('trypost.platforms.tiktok.api').'/test'); $exception = TikTokPublishException::fromApiResponse($fakeResponse); @@ -91,7 +91,7 @@ ], ], 400); - $fakeResponse = Http::fake(['*' => $response])->post('https://open.tiktokapis.com/test'); + $fakeResponse = Http::fake(['*' => $response])->post(config('trypost.platforms.tiktok.api').'/test'); $exception = TikTokPublishException::fromApiResponse($fakeResponse);