X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fobject%2Ffetcher_test.exs;h=3b666e0d141fc77a8604442c1087b7622041a598;hb=a87c313309b73ced5970c59d00117c357f51fecb;hp=58abcfe5522ac26414137988b4df9d547ca22c64;hpb=afae3ada22fb714735fd75448c574276353f2e1d;p=akkoma diff --git a/test/object/fetcher_test.exs b/test/object/fetcher_test.exs index 58abcfe55..3b666e0d1 100644 --- a/test/object/fetcher_test.exs +++ b/test/object/fetcher_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Object.FetcherTest do use Pleroma.DataCase @@ -11,6 +15,9 @@ defmodule Pleroma.Object.FetcherTest do %{method: :get, url: "https://mastodon.example.org/users/userisgone"} -> %Tesla.Env{status: 410} + %{method: :get, url: "https://mastodon.example.org/users/userisgone404"} -> + %Tesla.Env{status: 404} + env -> apply(HttpRequestMock, :request, [env]) end) @@ -100,6 +107,13 @@ defmodule Pleroma.Object.FetcherTest do "https://mastodon.example.org/users/userisgone" ) end + + test "handle HTTP 404 response" do + assert {:error, "Object has been deleted"} == + Fetcher.fetch_and_contain_remote_object_from_id( + "https://mastodon.example.org/users/userisgone404" + ) + end end describe "pruning" do