Delete barely used logger mock
It required a bunch of and even call-specific boilerplate and is not necessary since we can just capture the real logger as laready done in other tests.
This commit is contained in:
parent
f4e188af0a
commit
c94a3b10ee
5 changed files with 8 additions and 23 deletions
|
|
@ -129,9 +129,7 @@
|
|||
|
||||
config :pleroma, Pleroma.Web.WebFinger, update_nickname_on_user_fetch: false
|
||||
|
||||
config :pleroma, :side_effects,
|
||||
ap_streamer: Pleroma.Web.ActivityPub.ActivityPubMock,
|
||||
logger: Pleroma.LoggerMock
|
||||
config :pleroma, :side_effects, ap_streamer: Pleroma.Web.ActivityPub.ActivityPubMock
|
||||
|
||||
config :pleroma, Pleroma.Search, module: Pleroma.Search.DatabaseSearch
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Logging do
|
||||
@callback error(String.t()) :: any()
|
||||
end
|
||||
|
|
@ -27,8 +27,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
require Pleroma.Constants
|
||||
require Logger
|
||||
|
||||
@logger Pleroma.Config.get([:side_effects, :logger], Logger)
|
||||
|
||||
@behaviour Pleroma.Web.ActivityPub.SideEffects.Handling
|
||||
|
||||
defp ap_streamer, do: Pleroma.Config.get([:side_effects, :ap_streamer], ActivityPub)
|
||||
|
|
@ -320,7 +318,7 @@ def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object,
|
|||
:ok
|
||||
else
|
||||
{:actor, _} ->
|
||||
@logger.error("The object doesn't have an actor: #{inspect(deleted_object)}")
|
||||
Logger.error("The object doesn't have an actor: #{inspect(deleted_object)}")
|
||||
:no_object_actor
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects.DeleteTest do
|
|||
alias Pleroma.Web.ActivityPub.SideEffects
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
alias Pleroma.LoggerMock
|
||||
alias Pleroma.Web.ActivityPub.ActivityPubMock
|
||||
|
||||
import Mox
|
||||
|
|
@ -133,13 +132,12 @@ test "it logs issues with objects deletion", %{
|
|||
delete: delete,
|
||||
object: object
|
||||
} do
|
||||
{:ok, _object} =
|
||||
object
|
||||
|> Object.change(%{data: Map.delete(object.data, "actor")})
|
||||
|> Repo.update()
|
||||
|
||||
LoggerMock
|
||||
|> expect(:error, fn str -> assert str =~ "The object doesn't have an actor" end)
|
||||
ExUnit.CaptureLog.capture_log(fn ->
|
||||
{:ok, _object} =
|
||||
object
|
||||
|> Object.change(%{data: Map.delete(object.data, "actor")})
|
||||
|> Repo.update()
|
||||
end) =~ "The object doesn't have an actor"
|
||||
|
||||
{:error, :no_object_actor} = SideEffects.handle(delete)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -27,5 +27,3 @@
|
|||
|
||||
Mox.defmock(Pleroma.ConfigMock, for: Pleroma.Config.Getting)
|
||||
Mox.defmock(Pleroma.UnstubbedConfigMock, for: Pleroma.Config.Getting)
|
||||
|
||||
Mox.defmock(Pleroma.LoggerMock, for: Pleroma.Logging)
|
||||
|
|
|
|||
Loading…
Reference in a new issue