From 697c97873b171621ad04c06f7bf548c6416eb0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 29 May 2024 17:41:40 +0200 Subject: [PATCH] Fix test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- test/pleroma/webhook/notify_test.ex | 29 ---------------------------- test/pleroma/webhook/notify_test.exs | 4 ++-- 2 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 test/pleroma/webhook/notify_test.ex diff --git a/test/pleroma/webhook/notify_test.ex b/test/pleroma/webhook/notify_test.ex deleted file mode 100644 index 8aa9de08c6..0000000000 --- a/test/pleroma/webhook/notify_test.ex +++ /dev/null @@ -1,29 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2022 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Webhook.NotifyTest do - use Pleroma.DataCase, async: true - - alias Pleroma.Webhook - alias Pleroma.Webhook.Notify - - import Pleroma.Factory - - test "notifies have a valid signature" do - activity = insert(:report_activity) - - %{secret: secret} = - webhook = Webhook.create(%{url: "https://example.com/webhook", events: [:"report.created"]}) - - Tesla.Mock.mock(fn %{url: "https://example.com/webhook", body: body, headers: headers} = _ -> - {"X-Hub-Signature", "sha256=" <> signature} = - Enum.find(headers, fn {key, _} -> key == "X-Hub-Signature" end) - - assert signature == :crypto.mac(:hmac, :sha256, secret, body) |> Base.encode16() - %Tesla.Env{status: 200, body: ""} - end) - - Notify.report_created(webhook, activity) - end -end diff --git a/test/pleroma/webhook/notify_test.exs b/test/pleroma/webhook/notify_test.exs index 4190b1a170..f2a05400ad 100644 --- a/test/pleroma/webhook/notify_test.exs +++ b/test/pleroma/webhook/notify_test.exs @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Webhook.NotifyTest do - use Pleroma.DataCase, async: true + use Pleroma.DataCase alias Pleroma.Webhook alias Pleroma.Webhook.Notify @@ -21,7 +21,7 @@ test "notifies have a valid signature" do {"X-Hub-Signature", "sha256=" <> signature} = Enum.find(headers, fn {key, _} -> key == "X-Hub-Signature" end) - assert signature == :crypto.mac(:hmac, :sha256, secret, body) |> Base.encode16() + assert signature == :crypto.mac(:hmac, :sha256, secret, body) |> Base.encode16(case: :lower) %Tesla.Env{status: 200, body: ""} end)