Upgrade oban to 2.0

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-08-12 14:34:19 +02:00
parent f4e06455a3
commit 9a0068dfea
12 changed files with 67 additions and 70 deletions

View File

@@ -861,7 +861,7 @@ defmodule Mobilizon.Federation.ActivityPub.TransmogrifierTest do
end)
{:ok, _activity, _actor} = Transmogrifier.handle_incoming(data)
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background)
assert {:error, :actor_not_found} = Actors.get_actor_by_url(url)
assert {:error, :event_not_found} = Events.get_event(event1.id)

View File

@@ -511,7 +511,7 @@ defmodule Mobilizon.GraphQL.Resolvers.PersonTest do
args: %{"actor_id" => person_id, "op" => "delete_actor", "reserve_username" => true}
)
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background)
query = """
{
@@ -708,7 +708,7 @@ defmodule Mobilizon.GraphQL.Resolvers.PersonTest do
assert is_nil(res["errors"])
assert res["data"]["suspendProfile"]["id"] == to_string(remote_profile_id)
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background)
res =
conn

View File

@@ -1381,7 +1381,7 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do
assert Users.get_user(user.id).disabled == true
assert %{success: 2, failure: 0} == Oban.drain_queue(:background)
assert %{success: 2, failure: 0} == Oban.drain_queue(queue: :background)
assert_raise Ecto.NoResultsError, fn ->
Events.get_event!(event_id)

View File

@@ -370,7 +370,7 @@ defmodule Mobilizon.ActorsTest do
args: %{"actor_id" => actor.id, "op" => "delete_actor", "reserve_username" => true}
)
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background)
assert %Actor{
name: nil,

View File

@@ -32,10 +32,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{id: participant_id} =
participant = insert(:participant, role: :participant, actor: actor)
Notification.perform(
%{"op" => "before_event_notification", "participant_id" => participant_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "before_event_notification", "participant_id" => participant_id}
})
assert_delivered_email(
NotificationMailer.before_event_notification(
@@ -59,10 +58,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
assert {:ok, %Participant{}} = Events.delete_participant(participant)
Notification.perform(
%{"op" => "before_event_notification", "participant_id" => participant_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "before_event_notification", "participant_id" => participant_id}
})
refute_delivered_email(
NotificationMailer.before_event_notification(
@@ -78,10 +76,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{id: participant_id} =
participant = insert(:participant, role: :participant, event: event)
Notification.perform(
%{"op" => "before_event_notification", "participant_id" => participant_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "before_event_notification", "participant_id" => participant_id}
})
refute_delivered_email(
NotificationMailer.before_event_notification(
@@ -104,10 +101,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{} = participant = insert(:participant, role: :participant, actor: actor)
Notification.perform(
%{"op" => "on_day_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "on_day_notification", "user_id" => user_id}
})
assert_delivered_email(
NotificationMailer.on_day_notification(
@@ -137,10 +133,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
assert {:ok, %Participant{}} = Events.delete_participant(participant)
Notification.perform(
%{"op" => "on_day_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "on_day_notification", "user_id" => user_id}
})
refute_delivered_email(
NotificationMailer.on_day_notification(
@@ -164,10 +159,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{} =
participant = insert(:participant, role: :participant, event: event, actor: actor)
Notification.perform(
%{"op" => "on_day_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "on_day_notification", "user_id" => user_id}
})
refute_delivered_email(
NotificationMailer.on_day_notification(
@@ -193,10 +187,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
acc ++ [participant]
end)
Notification.perform(
%{"op" => "on_day_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "on_day_notification", "user_id" => user_id}
})
refute_delivered_email(
NotificationMailer.on_day_notification(
@@ -220,10 +213,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{} = participant = insert(:participant, role: :participant, actor: actor)
Notification.perform(
%{"op" => "weekly_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "weekly_notification", "user_id" => user_id}
})
assert_delivered_email(
NotificationMailer.weekly_notification(
@@ -253,10 +245,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
assert {:ok, %Participant{}} = Events.delete_participant(participant)
Notification.perform(
%{"op" => "weekly_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "weekly_notification", "user_id" => user_id}
})
refute_delivered_email(
NotificationMailer.weekly_notification(
@@ -280,10 +271,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{} =
participant = insert(:participant, role: :participant, event: event, actor: actor)
Notification.perform(
%{"op" => "weekly_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "weekly_notification", "user_id" => user_id}
})
refute_delivered_email(
NotificationMailer.weekly_notification(
@@ -309,10 +299,9 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
acc ++ [participant]
end)
Notification.perform(
%{"op" => "weekly_notification", "user_id" => user_id},
nil
)
Notification.perform(%Oban.Job{
args: %{"op" => "weekly_notification", "user_id" => user_id}
})
refute_delivered_email(
NotificationMailer.weekly_notification(
@@ -333,14 +322,13 @@ defmodule Mobilizon.Service.Workers.NotificationTest do
%Participant{} = insert(:participant, event: event, role: :not_approved)
%Participant{} = insert(:participant, event: event, role: :not_approved)
Notification.perform(
%{
Notification.perform(%Oban.Job{
args: %{
"op" => "pending_participation_notification",
"user_id" => user_id,
"event_id" => event_id
},
nil
)
}
})
assert_delivered_email(
NotificationMailer.pending_participation_notification(