Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / test / pleroma / web / mastodon_api / controllers / search_controller_test.exs
index 2f0bce450ddfb0cd9c59807e69694f057e29d51e..1dd0fa3b8392c6518947ab83060c53b68d7e01cc 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
@@ -281,6 +281,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
     test "search fetches remote statuses and prefers them over other results", %{conn: conn} do
       old_version = :persistent_term.get({Pleroma.Repo, :postgres_version})
       :persistent_term.put({Pleroma.Repo, :postgres_version}, 10.0)
+      on_exit(fn -> :persistent_term.put({Pleroma.Repo, :postgres_version}, old_version) end)
 
       capture_log(fn ->
         {:ok, %{id: activity_id}} =
@@ -298,8 +299,6 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
                  %{"id" => ^activity_id}
                ] = results["statuses"]
       end)
-
-      :persistent_term.put({Pleroma.Repo, :postgres_version}, old_version)
     end
 
     test "search doesn't show statuses that it shouldn't", %{conn: conn} do
@@ -310,7 +309,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
         })
 
       capture_log(fn ->
-        q = Object.normalize(activity).data["id"]
+        q = Object.normalize(activity, fetch: false).data["id"]
 
         results =
           conn