Fix tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-04 13:08:05 +02:00
parent 8d87cd12a9
commit 71cecb5b2c
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
5 changed files with 21 additions and 13 deletions

View file

@ -82,8 +82,3 @@ config :junit_formatter, report_dir: "."
if System.get_env("DOCKER", "false") == "false" && File.exists?("./config/test.secret.exs") do if System.get_env("DOCKER", "false") == "false" && File.exists?("./config/test.secret.exs") do
import_config "test.secret.exs" import_config "test.secret.exs"
end end
config :mobilizon, Mobilizon.Service.Notifier,
notifiers: [
Mobilizon.Service.Notifier.Mock
]

View file

@ -14,11 +14,6 @@ defmodule Mobilizon.GraphQL.Resolvers.ActivityTest do
setup %{conn: conn} do setup %{conn: conn} do
group = insert(:group) group = insert(:group)
Mobilizon.Config.put([Mobilizon.Service.Notifier, :notifiers], [
Mobilizon.Service.Notifier.Email,
Mobilizon.Service.Notifier.Push
])
{:ok, conn: conn, group: group} {:ok, conn: conn, group: group}
end end

View file

@ -5,7 +5,7 @@ defmodule Mobilizon.Service.Workers.ActivityBuilderTest do
alias Mobilizon.Activities.Activity alias Mobilizon.Activities.Activity
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Service.Notifier.Mock, as: NotifierMock alias Mobilizon.Service.Notifier.Mock2, as: NotifierMock
alias Mobilizon.Service.Workers.ActivityBuilder alias Mobilizon.Service.Workers.ActivityBuilder
alias Mobilizon.Users.User alias Mobilizon.Users.User
@ -14,6 +14,16 @@ defmodule Mobilizon.Service.Workers.ActivityBuilderTest do
import Mobilizon.Factory import Mobilizon.Factory
import Mox import Mox
setup_all do
Mox.defmock(NotifierMock, for: Mobilizon.Service.Notifier)
Mobilizon.Config.put([Mobilizon.Service.Notifier, :notifiers], [
NotifierMock
])
:ok
end
setup :verify_on_exit! setup :verify_on_exit!
describe "Sends direct email notification to users" do describe "Sends direct email notification to users" do

View file

@ -15,6 +15,16 @@ defmodule Mobilizon.Service.Workers.LegacyNotifierBuilderTest do
import Mox import Mox
import Mobilizon.Factory import Mobilizon.Factory
setup_all do
Mox.defmock(Mobilizon.Service.Notifier.Mock, for: Mobilizon.Service.Notifier)
Mobilizon.Config.put([Mobilizon.Service.Notifier, :notifiers], [
Mobilizon.Service.Notifier.Mock
])
:ok
end
@mentionned %{ @mentionned %{
"type" => "comment", "type" => "comment",
"subject" => "event_comment_mention", "subject" => "event_comment_mention",

View file

@ -79,6 +79,4 @@ defmodule Mobilizon.DataCase do
Mox.defmock(Mobilizon.Service.HTTP.GeospatialClient.Mock, Mox.defmock(Mobilizon.Service.HTTP.GeospatialClient.Mock,
for: Tesla.Adapter for: Tesla.Adapter
) )
Mox.defmock(Mobilizon.Service.Notifier.Mock, for: Mobilizon.Service.Notifier)
end end