diff --git a/test/mix/pleroma_test.exs b/test/mix/pleroma_test.exs index af62cc1d9..dfc457080 100644 --- a/test/mix/pleroma_test.exs +++ b/test/mix/pleroma_test.exs @@ -21,7 +21,7 @@ test "input" do send(self(), {:mix_shell_input, :prompt, "Yes"}) answer = shell_prompt("Do you want this?") - assert_received {:mix_shell, :prompt, [message]} + assert_receive {:mix_shell, :prompt, [message]} assert message =~ "Do you want this?" assert answer == "Yes" end @@ -31,7 +31,7 @@ test "with defval" do answer = shell_prompt("Do you want this?", "defval") - assert_received {:mix_shell, :prompt, [message]} + assert_receive {:mix_shell, :prompt, [message]} assert message =~ "Do you want this? [defval]" assert answer == "defval" end diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs index 15ffe0ce6..46c109cc1 100644 --- a/test/mix/tasks/pleroma/config_test.exs +++ b/test/mix/tasks/pleroma/config_test.exs @@ -58,7 +58,7 @@ test "config migration refused when deprecated settings are found" do MixTask.migrate_to_db("test/fixtures/config/temp.secret.exs") - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "Migration is not allowed until all deprecation warnings have been resolved." diff --git a/test/mix/tasks/pleroma/uploads_test.exs b/test/mix/tasks/pleroma/uploads_test.exs index a7d15e0fa..d2e4d85a9 100644 --- a/test/mix/tasks/pleroma/uploads_test.exs +++ b/test/mix/tasks/pleroma/uploads_test.exs @@ -24,15 +24,15 @@ test "uploads migrated" do store: fn %Upload{name: _file, path: _path}, _opts -> {:ok, %{}} end do Mix.Tasks.Pleroma.Uploads.run(["migrate_local", "S3"]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Migrating files from local" - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert %{"total_count" => total_count} = Regex.named_captures(~r"^Found (?\d+) uploads$", message) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} # @logevery in Mix.Tasks.Pleroma.Uploads count = diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index a2178bbd1..906e8a5d3 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -52,13 +52,13 @@ test "user is created" do "--admin" ]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "user will be created" - assert_received {:mix_shell, :prompt, [message]} + assert_receive {:mix_shell, :prompt, [message]} assert message =~ "Continue" - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "created" user = User.get_cached_by_nickname(unsaved.nickname) @@ -77,13 +77,13 @@ test "user is not created" do Mix.Tasks.Pleroma.User.run(["new", unsaved.nickname, unsaved.email]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "user will be created" - assert_received {:mix_shell, :prompt, [message]} + assert_receive {:mix_shell, :prompt, [message]} assert message =~ "Continue" - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "will not be created" refute User.get_cached_by_nickname(unsaved.nickname) @@ -100,7 +100,7 @@ test "user is deleted" do Mix.Tasks.Pleroma.User.run(["rm", user.nickname]) ObanHelpers.perform_all() - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ " deleted" assert %{is_active: false} = User.get_by_nickname(user.nickname) @@ -138,7 +138,7 @@ test "a remote user's create activity is deleted when the object has been pruned Mix.Tasks.Pleroma.User.run(["rm", user.nickname]) ObanHelpers.perform_all() - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ " deleted" assert %{is_active: false} = User.get_by_nickname(user.nickname) @@ -152,7 +152,7 @@ test "a remote user's create activity is deleted when the object has been pruned test "no user to delete" do Mix.Tasks.Pleroma.User.run(["rm", "nonexistent"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -169,7 +169,7 @@ test "active user is deactivated and unsubscribed" do Mix.Tasks.Pleroma.User.run(["deactivate", user.nickname]) # Note that the task has delay :timer.sleep(500) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "Successfully deactivated #{user.nickname} and unsubscribed all local followers" @@ -183,7 +183,7 @@ test "user is deactivated" do %{id: id, nickname: nickname} = insert(:user, is_active: false) assert :ok = Mix.Tasks.Pleroma.User.run(["deactivate", nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "User #{nickname} already deactivated" user = Repo.get(User, id) @@ -193,7 +193,7 @@ test "user is deactivated" do test "no user to deactivate" do Mix.Tasks.Pleroma.User.run(["deactivate", "nonexistent"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No user" end end @@ -211,16 +211,16 @@ test "All statuses set" do "--moderator" ]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Admin status .* true/ - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Confirmation status.* true/ - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Locked status .* true/ - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Moderator status .* true/ user = User.get_cached_by_nickname(user.nickname) @@ -248,16 +248,16 @@ test "All statuses unset" do "--no-moderator" ]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Admin status .* false/ - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Confirmation status.* false/ - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Locked status .* false/ - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ ~r/Moderator status .* false/ user = User.get_cached_by_nickname(user.nickname) @@ -270,7 +270,7 @@ test "All statuses unset" do test "no user to set status" do Mix.Tasks.Pleroma.User.run(["set", "nonexistent", "--moderator"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -283,14 +283,14 @@ test "password reset token is generated" do Mix.Tasks.Pleroma.User.run(["reset_password", user.nickname]) end) =~ "URL:" - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Generated" end test "no user to reset password" do Mix.Tasks.Pleroma.User.run(["reset_password", "nonexistent"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -307,7 +307,7 @@ test "disables MFA" do Mix.Tasks.Pleroma.User.run(["reset_mfa", user.nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "Multi-Factor Authentication disabled for #{user.nickname}" assert %{enabled: false, totp: false} == @@ -319,7 +319,7 @@ test "disables MFA" do test "no user to reset MFA" do Mix.Tasks.Pleroma.User.run(["reset_password", "nonexistent"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -330,7 +330,7 @@ test "invite token is generated" do Mix.Tasks.Pleroma.User.run(["invite"]) end) =~ "http" - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Generated user invite token one time" end @@ -343,7 +343,7 @@ test "token is generated with expires_at" do ]) end) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Generated user invite token date limited" end @@ -356,7 +356,7 @@ test "token is generated with max use" do ]) end) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Generated user invite token reusable" end @@ -371,7 +371,7 @@ test "token is generated with max use and expires date" do ]) end) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Generated user invite token reusable date limited" end end @@ -390,9 +390,9 @@ test "invites are listed" do # end) - assert_received {:mix_shell, :info, [message]} - assert_received {:mix_shell, :info, [message2]} - assert_received {:mix_shell, :info, [message3]} + assert_receive {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message2]} + assert_receive {:mix_shell, :info, [message3]} assert message =~ "Invites list:" assert message2 =~ invite.invite_type assert message3 =~ invite2.invite_type @@ -410,7 +410,7 @@ test "invite is revoked" do ]) end) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message =~ "Invite for token #{invite.token} was revoked." end end @@ -420,14 +420,14 @@ test "activities are deleted" do %{nickname: nickname} = insert(:user) assert :ok == Mix.Tasks.Pleroma.User.run(["delete_activities", nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "User #{nickname} statuses deleted." end test "it prints an error message when user is not exist" do Mix.Tasks.Pleroma.User.run(["delete_activities", "foo"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -437,7 +437,7 @@ test "user is confirmed" do %{id: id, nickname: nickname} = insert(:user, is_confirmed: true) assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "#{nickname} doesn't need confirmation." user = Repo.get(User, id) @@ -450,7 +450,7 @@ test "user is not confirmed" do insert(:user, is_confirmed: false, confirmation_token: "some token") assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "#{nickname} doesn't need confirmation." user = Repo.get(User, id) @@ -461,7 +461,7 @@ test "user is not confirmed" do test "it prints an error message when user is not exist" do Mix.Tasks.Pleroma.User.run(["confirm", "foo"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -471,7 +471,7 @@ test "user is activated" do %{id: id, nickname: nickname} = insert(:user, is_active: true) assert :ok = Mix.Tasks.Pleroma.User.run(["activate", nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "User #{nickname} already activated" user = Repo.get(User, id) @@ -482,7 +482,7 @@ test "user is not activated" do %{id: id, nickname: nickname} = insert(:user, is_active: false) assert :ok = Mix.Tasks.Pleroma.User.run(["activate", nickname]) - assert_received {:mix_shell, :info, [message]} + assert_receive {:mix_shell, :info, [message]} assert message == "Successfully activated #{nickname}" user = Repo.get(User, id) @@ -492,7 +492,7 @@ test "user is not activated" do test "no user to activate" do Mix.Tasks.Pleroma.User.run(["activate", "foo"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No user" end end @@ -536,7 +536,7 @@ test "it deletes all user's tokens and authorizations" do test "it prints an error message when user is not exist" do Mix.Tasks.Pleroma.User.run(["sign_out", "foo"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "No local user" end end @@ -554,7 +554,7 @@ test "it add tags to a user" do test "it prints an error message when user is not exist" do Mix.Tasks.Pleroma.User.run(["tag", "foo"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "Could not change user tags" end end @@ -573,7 +573,7 @@ test "it deletes tags from a user" do test "it prints an error message when user is not exist" do Mix.Tasks.Pleroma.User.run(["untag", "foo"]) - assert_received {:mix_shell, :error, [message]} + assert_receive {:mix_shell, :error, [message]} assert message =~ "Could not change user tags" end end diff --git a/test/pleroma/web/federator_test.exs b/test/pleroma/web/federator_test.exs index c774090d5..25386db41 100644 --- a/test/pleroma/web/federator_test.exs +++ b/test/pleroma/web/federator_test.exs @@ -49,7 +49,7 @@ test "with relays active, it publishes to the relay", %{ ObanHelpers.perform(all_enqueued(worker: PublisherWorker)) end - assert_received :relay_publish + assert_receive :relay_publish end test "with relays deactivated, it does not publish to the relay", %{ diff --git a/test/pleroma/web/o_auth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs index 4ea9c9f73..5df29b154 100644 --- a/test/pleroma/web/o_auth/ldap_authorization_test.exs +++ b/test/pleroma/web/o_auth/ldap_authorization_test.exs @@ -50,7 +50,7 @@ test "authorizes the existing user using LDAP credentials" do token = Repo.get_by(Token, token: token) assert token.user_id == user.id - assert_received :close_connection + assert_receive :close_connection end end @@ -94,7 +94,7 @@ test "creates a new user after successful LDAP authorization" do token = Repo.get_by(Token, token: token) |> Repo.preload(:user) assert token.user.nickname == user.nickname - assert_received :close_connection + assert_receive :close_connection end end @@ -129,7 +129,7 @@ test "disallow authorization for wrong LDAP credentials" do }) assert %{"error" => "Invalid credentials"} = json_response(conn, 400) - assert_received :close_connection + assert_receive :close_connection end end end diff --git a/test/pleroma/workers/cron/digest_emails_worker_test.exs b/test/pleroma/workers/cron/digest_emails_worker_test.exs index b3ca6235b..461622440 100644 --- a/test/pleroma/workers/cron/digest_emails_worker_test.exs +++ b/test/pleroma/workers/cron/digest_emails_worker_test.exs @@ -39,7 +39,7 @@ test "it sends digest emails", %{user2: user2} do # Performing job(s) enqueued at previous step ObanHelpers.perform_all() - assert_received {:email, email} + assert_receive {:email, email} assert email.to == [{user2.name, user2.email}] assert email.subject == "Your digest from #{Pleroma.Config.get(:instance)[:name]}" end diff --git a/test/pleroma/workers/cron/new_users_digest_worker_test.exs b/test/pleroma/workers/cron/new_users_digest_worker_test.exs index f9ef265c2..8a2d7b316 100644 --- a/test/pleroma/workers/cron/new_users_digest_worker_test.exs +++ b/test/pleroma/workers/cron/new_users_digest_worker_test.exs @@ -20,7 +20,7 @@ test "it sends new users digest emails" do NewUsersDigestWorker.perform(%Oban.Job{}) ObanHelpers.perform_all() - assert_received {:email, email} + assert_receive {:email, email} assert email.to == [{admin.name, admin.email}] assert email.subject == "#{Pleroma.Config.get([:instance, :name])} New Users"