Setup support for syndicating to Bluesky

This commit is contained in:
Jonny Barnes 2024-03-23 21:19:54 +00:00
parent 5d6d611707
commit cbbe87e23c
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
9 changed files with 204 additions and 9 deletions

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Tests\Feature;
use App\Jobs\SendWebMentions;
use App\Jobs\SyndicateNoteToBluesky;
use App\Jobs\SyndicateNoteToMastodon;
use App\Models\Media;
use App\Models\Note;
@ -123,18 +124,18 @@ class MicropubControllerTest extends TestCase
}
/** @test */
public function micropubClientCanRequestTheNewNoteIsSyndicatedToTwitterAndMastodon(): void
public function micropubClientCanRequestTheNewNoteIsSyndicatedToMastodonAndBluesky(): void
{
Queue::fake();
SyndicationTarget::factory()->create([
'uid' => 'https://twitter.com/jonnybarnes',
'service_name' => 'Twitter',
]);
SyndicationTarget::factory()->create([
'uid' => 'https://mastodon.social/@jonnybarnes',
'service_name' => 'Mastodon',
]);
SyndicationTarget::factory()->create([
'uid' => 'https://bsky.app/profile/jonnybarnes.uk',
'service_name' => 'Bluesky',
]);
$faker = Factory::create();
$note = $faker->text;
@ -145,6 +146,7 @@ class MicropubControllerTest extends TestCase
'content' => $note,
'mp-syndicate-to' => [
'https://mastodon.social/@jonnybarnes',
'https://bsky.app/profile/jonnybarnes.uk',
],
],
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
@ -152,6 +154,7 @@ class MicropubControllerTest extends TestCase
$response->assertJson(['response' => 'created']);
$this->assertDatabaseHas('notes', ['note' => $note]);
Queue::assertPushed(SyndicateNoteToMastodon::class);
Queue::assertPushed(SyndicateNoteToBluesky::class);
}
/** @test */
@ -249,6 +252,10 @@ class MicropubControllerTest extends TestCase
'uid' => 'https://mastodon.social/@jonnybarnes',
'service_name' => 'Mastodon',
]);
SyndicationTarget::factory()->create([
'uid' => 'https://bsky.app/profile/jonnybarnes.uk',
'service_name' => 'Bluesky',
]);
$faker = Factory::create();
$note = $faker->text;
@ -261,6 +268,7 @@ class MicropubControllerTest extends TestCase
'in-reply-to' => ['https://aaronpk.localhost'],
'mp-syndicate-to' => [
'https://mastodon.social/@jonnybarnes',
'https://bsky.app/profile/jonnybarnes.uk',
],
'photo' => [config('filesystems.disks.s3.url') . '/test-photo.jpg'],
],
@ -272,6 +280,7 @@ class MicropubControllerTest extends TestCase
->assertJson(['response' => 'created']);
Queue::assertPushed(SendWebMentions::class);
Queue::assertPushed(SyndicateNoteToMastodon::class);
Queue::assertPushed(SyndicateNoteToBluesky::class);
}
/**