Fix tests
Need to handle the edge case of no valid HTTP response which has no status code
This commit is contained in:
parent
4afe211e50
commit
833117f573
|
@ -128,6 +128,12 @@ def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = pa
|
||||||
%{status: 410} -> {:discard, :not_found}
|
%{status: 410} -> {:discard, :not_found}
|
||||||
_ -> {:error, e}
|
_ -> {:error, e}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
e ->
|
||||||
|
unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
|
||||||
|
Logger.metadata(activity: id, inbox: inbox)
|
||||||
|
Logger.error("Publisher failed to inbox #{inbox} #{inspect(e)}")
|
||||||
|
{:error, e}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,8 @@ test "publish to url with with different ports" do
|
||||||
actor = insert(:user)
|
actor = insert(:user)
|
||||||
inbox = "http://404.site/users/nick1/inbox"
|
inbox = "http://404.site/users/nick1/inbox"
|
||||||
|
|
||||||
assert {:error, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
|
assert {:discard, _} =
|
||||||
|
Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
|
||||||
|
|
||||||
assert called(Instances.set_unreachable(inbox))
|
assert called(Instances.set_unreachable(inbox))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue