Use new syndication target model when processing MicroPub requests

This commit is contained in:
Jonny Barnes 2022-10-23 20:38:12 +01:00
parent 976929e9b9
commit 66257e7e9b
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
6 changed files with 61 additions and 52 deletions

View file

@ -7,6 +7,7 @@ namespace Tests\Feature;
use App\Jobs\ProcessBookmark;
use App\Jobs\SyndicateBookmarkToTwitter;
use App\Models\Bookmark;
use App\Models\SyndicationTarget;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;
@ -36,6 +37,11 @@ class BookmarksTest extends TestCase
{
Queue::fake();
SyndicationTarget::factory()->create([
'uid' => 'https://twitter.com/jonnybarnes',
'service_name' => 'Twitter',
]);
$response = $this->withHeaders([
'Authorization' => 'Bearer ' . $this->getToken(),
])->post('/api/post', [
@ -58,6 +64,11 @@ class BookmarksTest extends TestCase
{
Queue::fake();
SyndicationTarget::factory()->create([
'uid' => 'https://twitter.com/jonnybarnes',
'service_name' => 'Twitter',
]);
$response = $this->withHeaders([
'Authorization' => 'Bearer ' . $this->getToken(),
])->json('POST', '/api/post', [
@ -82,6 +93,11 @@ class BookmarksTest extends TestCase
{
Queue::fake();
SyndicationTarget::factory()->create([
'uid' => 'https://twitter.com/jonnybarnes',
'service_name' => 'Twitter',
]);
$response = $this->withHeaders([
'Authorization' => 'Bearer ' . $this->getToken(),
])->post('/api/post', [

View file

@ -126,6 +126,12 @@ class MicropubControllerTest extends TestCase
public function micropubClientCanRequestTheNewNoteIsSyndicatedToTwitter(): void
{
Queue::fake();
SyndicationTarget::factory()->create([
'uid' => 'https://twitter.com/jonnybarnes',
'service_name' => 'Twitter',
]);
$faker = Factory::create();
$note = $faker->text;
$response = $this->post(
@ -233,6 +239,11 @@ class MicropubControllerTest extends TestCase
'path' => 'test-photo.jpg',
'type' => 'image',
]);
SyndicationTarget::factory()->create([
'uid' => 'https://twitter.com/jonnybarnes',
'service_name' => 'Twitter',
]);
$faker = Factory::create();
$note = $faker->text;
$response = $this->postJson(