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/web/activity_pub | |
| 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/web/activity_pub')
| -rw-r--r-- | test/web/activity_pub/mrf/anti_link_spam_policy_test.exs | 9 | ||||
| -rw-r--r-- | test/web/activity_pub/relay_test.exs | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs b/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs index fc0be6f91..1a13699be 100644 --- a/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs +++ b/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs @@ -110,6 +110,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicyTest do end describe "with unknown actors" do + setup do + Tesla.Mock.mock(fn + %{method: :get, url: "http://invalid.actor"} -> + %Tesla.Env{status: 500, body: ""} + end) + + :ok + end + test "it rejects posts without links" do message = @linkless_message diff --git a/test/web/activity_pub/relay_test.exs b/test/web/activity_pub/relay_test.exs index e3115dcd8..12bf90d90 100644 --- a/test/web/activity_pub/relay_test.exs +++ b/test/web/activity_pub/relay_test.exs @@ -89,6 +89,11 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do } ) + Tesla.Mock.mock(fn + %{method: :get, url: "http://mastodon.example.org/eee/99541947525187367"} -> + %Tesla.Env{status: 500, body: ""} + end) + assert capture_log(fn -> assert Relay.publish(activity) == {:error, nil} end) =~ "[error] error: nil" |
