mirror of
https://github.com/pelican-dev/panel.git
synced 2026-07-16 04:03:50 +03:00
Update webhook tests for current payload format
This commit is contained in:
@@ -68,7 +68,7 @@ class DispatchWebhooksTest extends TestCase
|
||||
'events' => ['eloquent.created: '.Server::class],
|
||||
]);
|
||||
|
||||
$webhookConfig->update(['events' => 'eloquent.deleted: '.Server::class]);
|
||||
$webhookConfig->update(['events' => ['eloquent.deleted: '.Server::class]]);
|
||||
|
||||
$this->createServer();
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class ProcessWebhooksTest extends TestCase
|
||||
ProcessWebhook::dispatchSync(
|
||||
$webhook,
|
||||
'eloquent.created: '.Server::class,
|
||||
$data,
|
||||
[$data],
|
||||
);
|
||||
|
||||
$this->assertCount(1, cache()->get("webhooks.$eventName"));
|
||||
@@ -73,7 +73,7 @@ class ProcessWebhooksTest extends TestCase
|
||||
Http::assertSentCount(1);
|
||||
Http::assertSent(function (Request $request) use ($webhook, $data) {
|
||||
return $webhook->endpoint === $request->url()
|
||||
&& $request->data() === $data;
|
||||
&& $request->data() === array_merge($data, ['event' => 'created: Server']);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class ProcessWebhooksTest extends TestCase
|
||||
$this->assertDatabaseCount(Webhook::class, 1);
|
||||
|
||||
$webhook = Webhook::query()->first();
|
||||
$this->assertEquals($server->uuid, $webhook->payload[0]['uuid']);
|
||||
$this->assertEquals($server->uuid, $webhook->payload['uuid']);
|
||||
|
||||
$this->assertDatabaseHas(Webhook::class, [
|
||||
'endpoint' => $webhookConfig->endpoint,
|
||||
@@ -165,8 +165,11 @@ class ProcessWebhooksTest extends TestCase
|
||||
$server = $this->createServer();
|
||||
|
||||
$this->assertDatabaseCount(Webhook::class, 1);
|
||||
|
||||
$webhook = Webhook::query()->first();
|
||||
$this->assertEquals($server->uuid, $webhook->payload['uuid']);
|
||||
|
||||
$this->assertDatabaseHas(Webhook::class, [
|
||||
'payload' => json_encode([$server->toArray()]),
|
||||
'endpoint' => $webhookConfig->endpoint,
|
||||
'successful_at' => null,
|
||||
'event' => 'eloquent.created: '.Server::class,
|
||||
|
||||
Reference in New Issue
Block a user