1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added active toggle to webhooks

To allow easy temporary de-activation without deletion or other
workarounds. Updated tests to cover.
This commit is contained in:
Dan Brown
2021-12-12 17:39:06 +00:00
parent 917598f7c8
commit dbd4281ae8
10 changed files with 41 additions and 8 deletions

View File

@ -22,6 +22,7 @@ class WebhookManagementTest extends TestCase
$resp->assertElementExists('a[href="' . $webhook->getUrl() . '"]', $webhook->name);
$resp->assertSee($webhook->endpoint);
$resp->assertSee('All system events');
$resp->assertSee('Active');
}
public function test_create_view()
@ -38,6 +39,7 @@ class WebhookManagementTest extends TestCase
'name' => 'My first webhook',
'endpoint' => 'https://example.com/webhook',
'events' => ['all'],
'active' => 'true'
]);
$resp->assertRedirect('/settings/webhooks');
@ -49,6 +51,7 @@ class WebhookManagementTest extends TestCase
$this->assertDatabaseHas('webhooks', [
'name' => 'My first webhook',
'endpoint' => 'https://example.com/webhook',
'active' => true,
]);
/** @var Webhook $webhook */
@ -79,6 +82,7 @@ class WebhookManagementTest extends TestCase
'name' => 'My updated webhook',
'endpoint' => 'https://example.com/updated-webhook',
'events' => [ActivityType::PAGE_CREATE, ActivityType::PAGE_UPDATE],
'active' => 'true'
]);
$resp->assertRedirect('/settings/webhooks');
@ -89,6 +93,7 @@ class WebhookManagementTest extends TestCase
'id' => $webhook->id,
'name' => 'My updated webhook',
'endpoint' => 'https://example.com/updated-webhook',
'active' => true,
]);
$trackedEvents = $webhook->trackedEvents()->get();