PublisherTest: Use mox instead of mock.
This commit is contained in:
parent
ae0c0260fd
commit
3de250da23
7 changed files with 35 additions and 9 deletions
|
|
@ -556,13 +556,14 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
end
|
||||
|
||||
describe "prepare_one/1 with reporter anonymization" do
|
||||
test_with_mock "signs with the anonymized actor keys when Transmogrifier changes actor",
|
||||
Pleroma.Signature,
|
||||
[:passthrough],
|
||||
sign: fn %Pleroma.User{} = user, headers ->
|
||||
send(self(), {:signed_as, user.ap_id})
|
||||
"TESTSIG"
|
||||
end do
|
||||
test "signs with the anonymized actor keys when Transmogrifier changes actor" do
|
||||
Pleroma.SignatureMock
|
||||
|> Mox.stub(:signed_date, fn -> Pleroma.Signature.signed_date() end)
|
||||
|> Mox.expect(:sign, fn %Pleroma.User{} = user, _headers ->
|
||||
send(self(), {:signed_as, user.ap_id})
|
||||
"TESTSIG"
|
||||
end)
|
||||
|
||||
placeholder = insert(:user)
|
||||
reporter = insert(:user)
|
||||
target_account = insert(:user)
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ defmodule Pleroma.DataCase do
|
|||
Mox.stub_with(Pleroma.StubbedHTTPSignaturesMock, Pleroma.Test.HTTPSignaturesProxy)
|
||||
|
||||
Mox.stub_with(Pleroma.DateTimeMock, Pleroma.DateTime.Impl)
|
||||
Mox.stub_with(Pleroma.SignatureMock, Pleroma.Signature)
|
||||
end
|
||||
|
||||
def ensure_local_uploader(context) do
|
||||
|
|
|
|||
|
|
@ -40,3 +40,5 @@ Mox.defmock(Pleroma.Language.LanguageDetectorMock,
|
|||
|
||||
Mox.defmock(Pleroma.DateTimeMock, for: Pleroma.DateTime)
|
||||
Mox.defmock(Pleroma.MogrifyMock, for: Pleroma.MogrifyBehaviour)
|
||||
|
||||
Mox.defmock(Pleroma.SignatureMock, for: Pleroma.Signature.API)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue