Fix some more tests.
authoreal <eal@waifu.club>
Mon, 11 Dec 2017 19:01:36 +0000 (21:01 +0200)
committereal <eal@waifu.club>
Mon, 11 Dec 2017 19:01:36 +0000 (21:01 +0200)
test/web/mastodon_api/status_view_test.exs
test/web/twitter_api/views/user_view_test.exs

index 93c0b7236ec7cefd3742a09cfc78283bef7fe369..0d396f3b8418a97988b8473631afb3ce96007e24 100644 (file)
@@ -56,7 +56,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
 
   test "contains mentions" do
     incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml")
-    user = insert(:user, %{ap_id: "https://pleroma.soykaf.com/users/lain"})
+    # a user with this ap id might be in the cache.
+    recipient = "https://pleroma.soykaf.com/users/lain"
+    user = User.get_cached_by_ap_id(recipient) || insert(:user, %{ap_id: recipient})
 
     {:ok, [activity]} = OStatus.handle_incoming(incoming)
 
index 18a19ef700acd0d9f8279ae2aab1cbcffdd6e9bd..753e41d20bc2f7c857e04a9af098d780353f905c 100644 (file)
@@ -30,8 +30,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
     User.follow(follower, user)
     User.follow(second_follower, user)
     User.follow(user, follower)
-
-    user = Repo.get!(User, user.id)
+    {:ok, user} = User.update_follower_count(user)
+    Cachex.set(:user_cache, "user_info:#{user.id}", User.user_info(Repo.get!(User, user.id)))
 
     image = "https://placehold.it/48x48"