From d0de4fd8f9076119e5c06b5ba3887f16ff4b6b64 Mon Sep 17 00:00:00 2001
From: Dan Brown <ssddanbrown@googlemail.com>
Date: Mon, 3 Jan 2022 19:51:13 +0000
Subject: [PATCH] Fixed failing webhook test cases

---
 app/Actions/DispatchWebhookJob.php      | 1 -
 tests/Actions/WebhookManagementTest.php | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/Actions/DispatchWebhookJob.php b/app/Actions/DispatchWebhookJob.php
index 7cc530c10..8f78150a9 100644
--- a/app/Actions/DispatchWebhookJob.php
+++ b/app/Actions/DispatchWebhookJob.php
@@ -79,7 +79,6 @@ class DispatchWebhookJob implements ShouldQueue
                 ->withOptions(['allow_redirects' => ['strict' => true]])
                 ->timeout($this->webhook->timeout)
                 ->post($this->webhook->endpoint, $webhookData);
-
         } catch (\Exception $exception) {
             $lastError = $exception->getMessage();
             Log::error("Webhook call to endpoint {$this->webhook->endpoint} failed with error \"{$lastError}\"");
diff --git a/tests/Actions/WebhookManagementTest.php b/tests/Actions/WebhookManagementTest.php
index 206913c74..6eb328714 100644
--- a/tests/Actions/WebhookManagementTest.php
+++ b/tests/Actions/WebhookManagementTest.php
@@ -39,6 +39,7 @@ class WebhookManagementTest extends TestCase
             'endpoint' => 'https://example.com/webhook',
             'events'   => ['all'],
             'active'   => 'true',
+            'timeout'  => 4,
         ]);
 
         $resp->assertRedirect('/settings/webhooks');
@@ -51,6 +52,7 @@ class WebhookManagementTest extends TestCase
             'name'     => 'My first webhook',
             'endpoint' => 'https://example.com/webhook',
             'active'   => true,
+            'timeout'  => 4,
         ]);
 
         /** @var Webhook $webhook */
@@ -82,6 +84,7 @@ class WebhookManagementTest extends TestCase
             'endpoint' => 'https://example.com/updated-webhook',
             'events'   => [ActivityType::PAGE_CREATE, ActivityType::PAGE_UPDATE],
             'active'   => 'true',
+            'timeout'  => 5
         ]);
         $resp->assertRedirect('/settings/webhooks');
 
@@ -93,6 +96,7 @@ class WebhookManagementTest extends TestCase
             'name'     => 'My updated webhook',
             'endpoint' => 'https://example.com/updated-webhook',
             'active'   => true,
+            'timeout'  => 5,
         ]);
 
         $trackedEvents = $webhook->trackedEvents()->get();