Merge branch 'develop' into refactor/deactivated_user_field
[akkoma] / test / pleroma / web / mastodon_api / views / status_view_test.exs
index f2a7469edb436ab1459d26572b4ec6278cdfb041..ed59cf285652cab805ea999b225c8d672cc26975 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.StatusViewTest do
@@ -61,7 +61,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
     {:ok, activity} = CommonAPI.post(user, %{status: "yo"})
 
     activity
-    |> Object.normalize(false)
+    |> Object.normalize(fetch: false)
     |> Object.update_data(%{"reactions" => %{"☕" => [user.ap_id], "x" => 1}})
 
     activity = Activity.get_by_id(activity.id)
@@ -160,7 +160,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
     {:ok, activity} = CommonAPI.post(user, %{status: "Hey @shp!", visibility: "direct"})
 
     Repo.delete(user)
-    Cachex.clear(:user_cache)
+    User.invalidate_cache(user)
 
     finger_url =
       "https://localhost/.well-known/webfinger?resource=acct:#{user.nickname}@localhost"
@@ -194,7 +194,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
       |> Ecto.Changeset.change(%{ap_id: "#{user.ap_id}/extension/#{user.nickname}"})
       |> Repo.update()
 
-    Cachex.clear(:user_cache)
+    User.invalidate_cache(user)
 
     result = StatusView.render("show.json", activity: activity)
 
@@ -204,7 +204,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
 
   test "a note with null content" do
     note = insert(:note_activity)
-    note_object = Object.normalize(note)
+    note_object = Object.normalize(note, fetch: false)
 
     data =
       note_object.data
@@ -223,7 +223,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
 
   test "a note activity" do
     note = insert(:note_activity)
-    object_data = Object.normalize(note).data
+    object_data = Object.normalize(note, fetch: false).data
     user = User.get_cached_by_ap_id(note.data["actor"])
 
     convo_id = Utils.context_to_conversation_id(object_data["context"])
@@ -263,7 +263,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
       tags: [
         %{
           name: "#{object_data["tag"]}",
-          url: "/tag/#{object_data["tag"]}"
+          url: "http://localhost:4001/tag/#{object_data["tag"]}"
         }
       ],
       application: %{
@@ -585,9 +585,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
       ]
 
       assert StatusView.build_tags(object_tags) == [
-               %{name: "fediverse", url: "/tag/fediverse"},
-               %{name: "mastodon", url: "/tag/mastodon"},
-               %{name: "nextcloud", url: "/tag/nextcloud"}
+               %{name: "fediverse", url: "http://localhost:4001/tag/fediverse"},
+               %{name: "mastodon", url: "http://localhost:4001/tag/mastodon"},
+               %{name: "nextcloud", url: "http://localhost:4001/tag/nextcloud"}
              ]
     end
   end