Skip to content

A free open source IT asset/license management system

Explicitly disable webhook settings in tests

Marcus Mooreaefc53cfcf9e
diff --git a/database/factories/SettingFactory.php b/database/factories/SettingFactory.php
index acbd6afafa..2e19f831d7 100644
--- a/database/factories/SettingFactory.php
+++ b/database/factories/SettingFactory.php
@@ -52,4 +52,13 @@ class SettingFactory extends Factory
'webhook_channel' => '#it',
]);
}
+
+ public function withWebhookDisabled()
+ {
+ return $this->state(fn() => [
+ 'webhook_botname' => '',
+ 'webhook_endpoint' => '',
+ 'webhook_channel' => '',
+ ]);
+ }
}
diff --git a/tests/Feature/Notifications/AssetCheckoutWebhookNotificationTest.php b/tests/Feature/Notifications/AssetCheckoutWebhookNotificationTest.php
index 535bd62a3d..1523b93c09 100644
--- a/tests/Feature/Notifications/AssetCheckoutWebhookNotificationTest.php
+++ b/tests/Feature/Notifications/AssetCheckoutWebhookNotificationTest.php
@@ -61,6 +61,8 @@ class AssetCheckoutWebhookNotificationTest extends TestCase
{
Notification::fake();
+ Setting::factory()->withWebhookDisabled()->create();
+
event(new CheckoutableCheckedOut(
$this->createAsset(),
$checkoutTarget(),
diff --git a/tests/Feature/Notifications/LicenseCheckoutWebhookNotificationTest.php b/tests/Feature/Notifications/LicenseCheckoutWebhookNotificationTest.php
index 095e0c436c..57948a14b6 100644
--- a/tests/Feature/Notifications/LicenseCheckoutWebhookNotificationTest.php
+++ b/tests/Feature/Notifications/LicenseCheckoutWebhookNotificationTest.php
@@ -50,6 +50,8 @@ class LicenseCheckoutWebhookNotificationTest extends TestCase
{
Notification::fake();
+ Setting::factory()->withWebhookDisabled()->create();
+
event(new CheckoutableCheckedOut(
LicenseSeat::factory()->create(),
$checkoutTarget(),