From 81c319bdf87f9661ee81a065121eb89611ad04c2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 29 Sep 2021 20:28:03 +0200 Subject: [PATCH] Adapt to new Oban result Signed-off-by: Thomas Citharel --- .../activity_pub/transmogrifier/delete_test.exs | 2 +- .../activity_pub/transmogrifier/update_test.exs | 4 ++-- test/graphql/resolvers/activity_test.exs | 8 ++++---- test/graphql/resolvers/group_test.exs | 2 +- test/graphql/resolvers/person_test.exs | 4 ++-- test/graphql/resolvers/user_test.exs | 2 +- test/mobilizon/actors/actors_test.exs | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/federation/activity_pub/transmogrifier/delete_test.exs b/test/federation/activity_pub/transmogrifier/delete_test.exs index e6847646e..e2a77da99 100644 --- a/test/federation/activity_pub/transmogrifier/delete_test.exs +++ b/test/federation/activity_pub/transmogrifier/delete_test.exs @@ -105,7 +105,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.DeleteTest do end) {:ok, _activity, _actor} = Transmogrifier.handle_incoming(data) - assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background) + assert %{success: 1, snoozed: 0, 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) diff --git a/test/federation/activity_pub/transmogrifier/update_test.exs b/test/federation/activity_pub/transmogrifier/update_test.exs index b67f10631..9572caf94 100644 --- a/test/federation/activity_pub/transmogrifier/update_test.exs +++ b/test/federation/activity_pub/transmogrifier/update_test.exs @@ -51,7 +51,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do args: %{event_id: event_id, op: :insert_search_event} ) - assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :search) + assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :search) update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!() @@ -77,7 +77,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.UpdateTest do args: %{event_id: event_id, op: :update_search_event} ) - assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :search) + assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :search) assert event.title == "My updated event" diff --git a/test/graphql/resolvers/activity_test.exs b/test/graphql/resolvers/activity_test.exs index 7dd8f3bb1..d020d4723 100644 --- a/test/graphql/resolvers/activity_test.exs +++ b/test/graphql/resolvers/activity_test.exs @@ -181,7 +181,7 @@ defmodule Mobilizon.GraphQL.Resolvers.ActivityTest do event = insert(:event, attributed_to: group, organizer_actor: actor) EventActivity.insert_activity(event, subject: "event_created") - assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :activity) + assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :activity) assert Activities.list_activities() |> length() == 1 [%Activity{author_id: author_id, group_id: activity_group_id}] = @@ -230,7 +230,7 @@ defmodule Mobilizon.GraphQL.Resolvers.ActivityTest do post = insert(:post, author: actor, attributed_to: group) EventActivity.insert_activity(event, subject: "event_created") PostActivity.insert_activity(post, subject: "post_created") - assert %{success: 2, failure: 0} == Oban.drain_queue(queue: :activity) + assert %{success: 2, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :activity) assert Activities.list_activities() |> length() == 2 res = @@ -274,7 +274,7 @@ defmodule Mobilizon.GraphQL.Resolvers.ActivityTest do post = insert(:post, attributed_to: group) EventActivity.insert_activity(event, subject: "event_created") PostActivity.insert_activity(post, subject: "post_created") - assert %{success: 2, failure: 0} == Oban.drain_queue(queue: :activity) + assert %{success: 2, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :activity) assert Activities.list_activities() |> length() == 2 res = @@ -318,7 +318,7 @@ defmodule Mobilizon.GraphQL.Resolvers.ActivityTest do Process.sleep(1000) Posts.delete_post(post) PostActivity.insert_activity(post, subject: "post_deleted") - assert %{success: 2, failure: 0} == Oban.drain_queue(queue: :activity) + assert %{success: 2, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :activity) assert Activities.list_activities() |> length() == 2 res = diff --git a/test/graphql/resolvers/group_test.exs b/test/graphql/resolvers/group_test.exs index f8fc10894..6143062cc 100644 --- a/test/graphql/resolvers/group_test.exs +++ b/test/graphql/resolvers/group_test.exs @@ -384,7 +384,7 @@ defmodule Mobilizon.Web.Resolvers.GroupTest do # Can't be used right now, probably because we try to run a transaction in a Oban Job while using Ecto Sandbox - # assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background) + # assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :background) # res = # conn diff --git a/test/graphql/resolvers/person_test.exs b/test/graphql/resolvers/person_test.exs index a4c2f237f..7d2c272c8 100644 --- a/test/graphql/resolvers/person_test.exs +++ b/test/graphql/resolvers/person_test.exs @@ -519,7 +519,7 @@ defmodule Mobilizon.GraphQL.Resolvers.PersonTest do } ) - assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background) + assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :background) query = """ { @@ -719,7 +719,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(queue: :background) + assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :background) res = conn diff --git a/test/graphql/resolvers/user_test.exs b/test/graphql/resolvers/user_test.exs index 906cfa03e..293fcb212 100644 --- a/test/graphql/resolvers/user_test.exs +++ b/test/graphql/resolvers/user_test.exs @@ -1393,7 +1393,7 @@ defmodule Mobilizon.GraphQL.Resolvers.UserTest do assert is_nil(Users.get_user(user.id)) - assert %{success: 2, failure: 0} == Oban.drain_queue(queue: :background) + assert %{success: 2, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :background) assert_raise Ecto.NoResultsError, fn -> Events.get_event!(event_id) diff --git a/test/mobilizon/actors/actors_test.exs b/test/mobilizon/actors/actors_test.exs index e5bf81f7e..1a8417c0d 100644 --- a/test/mobilizon/actors/actors_test.exs +++ b/test/mobilizon/actors/actors_test.exs @@ -330,7 +330,7 @@ defmodule Mobilizon.ActorsTest do } ) - assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :background) + assert %{success: 1, snoozed: 0, failure: 0} == Oban.drain_queue(queue: :background) assert %Actor{ name: nil,