Add model to store syndication target data

This commit is contained in:
Jonny Barnes 2022-10-22 14:18:21 +01:00
parent 7cd9956b92
commit ea8395a651
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
5 changed files with 154 additions and 9 deletions

View file

@ -9,6 +9,7 @@ use App\Jobs\SyndicateNoteToTwitter;
use App\Models\Media;
use App\Models\Note;
use App\Models\Place;
use App\Models\SyndicationTarget;
use Carbon\Carbon;
use Faker\Factory;
use Illuminate\Foundation\Testing\RefreshDatabase;
@ -51,10 +52,18 @@ class MicropubControllerTest extends TestCase
}
/** @test */
public function micropubClientsCanRequestSyndicationTargets(): void
public function micropubClientsCanRequestSyndicationTargetsCanBeEmpty(): void
{
$response = $this->get('/api/post?q=syndicate-to', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
$response->assertJsonFragment(['uid' => 'https://twitter.com/jonnybarnes']);
$response->assertJsonFragment(['syndicate-to' => []]);
}
/** @test */
public function micropubClientsCanRequestSyndicationTargetsPopulatesFromModel(): void
{
$syndicationTarget = SyndicationTarget::factory()->create();
$response = $this->get('/api/post?q=syndicate-to', ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
$response->assertJsonFragment(['uid' => $syndicationTarget->uid]);
}
/** @test */