Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
test(tiktok): fake against the config base URL across all TikTok test files
Paulo Castellanoffa437761588
diff --git a/tests/Feature/Services/Social/TikTokCreatorInfoTest.php b/tests/Feature/Services/Social/TikTokCreatorInfoTest.phpindex 15ad23a9a..f12bed08c 100644--- a/tests/Feature/Services/Social/TikTokCreatorInfoTest.php+++ b/tests/Feature/Services/Social/TikTokCreatorInfoTest.php@@ -17,11 +17,13 @@ beforeEach(function () {]);$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 full creator payload from api response', function () {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 @@ test('it refreshes the token before calling when expired', function () {$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.phpindex b852e2188..c05d81356 100644--- a/tests/Unit/Exceptions/Social/TikTokPublishExceptionTest.php+++ b/tests/Unit/Exceptions/Social/TikTokPublishExceptionTest.php@@ -16,7 +16,7 @@ test('HTTP error rate_limit_exceeded maps to RateLimit category', function () {],], 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 @@ test('HTTP error access_token_invalid throws TokenExpiredException', function ()],], 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 @@ test('HTTP error invalid_file_upload maps to MediaFormat category', function ()],], 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 @@ test('unknown error code falls through with Unknown category', function () {],], 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);