diff options
| author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-03-05 17:31:06 +0300 |
|---|---|---|
| committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-03-05 17:31:06 +0300 |
| commit | f0753eed0fdddd30e127213c89a118dd2e087dc9 (patch) | |
| tree | 6cf9a2d9983fc42d11bb476aa2ba247b0b9c3338 /test/notification_test.exs | |
| parent | eb324467d9c5c761a776ffc98347246c61ad02ae (diff) | |
| download | pleroma-f0753eed0fdddd30e127213c89a118dd2e087dc9.tar.gz pleroma-f0753eed0fdddd30e127213c89a118dd2e087dc9.zip | |
removing try block in tesla request
added mocks for tests which fail with Tesla.Mock.Error
Diffstat (limited to 'test/notification_test.exs')
| -rw-r--r-- | test/notification_test.exs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs index 56a581810..c71df4e07 100644 --- a/test/notification_test.exs +++ b/test/notification_test.exs @@ -649,12 +649,20 @@ defmodule Pleroma.NotificationTest do "object" => remote_user.ap_id } + remote_user_url = remote_user.ap_id + + Tesla.Mock.mock(fn + %{method: :get, url: ^remote_user_url} -> + %Tesla.Env{status: 404, body: ""} + end) + {:ok, _delete_activity} = Transmogrifier.handle_incoming(delete_user_message) ObanHelpers.perform_all() assert Enum.empty?(Notification.for_user(local_user)) end + @tag capture_log: true test "move activity generates a notification" do %{ap_id: old_ap_id} = old_user = insert(:user) %{ap_id: new_ap_id} = new_user = insert(:user, also_known_as: [old_ap_id]) @@ -664,6 +672,18 @@ defmodule Pleroma.NotificationTest do User.follow(follower, old_user) User.follow(other_follower, old_user) + old_user_url = old_user.ap_id + + body = + File.read!("test/fixtures/users_mock/localhost.json") + |> String.replace("{{nickname}}", old_user.nickname) + |> Jason.encode!() + + Tesla.Mock.mock(fn + %{method: :get, url: ^old_user_url} -> + %Tesla.Env{status: 200, body: body} + end) + Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user) ObanHelpers.perform_all() |
