assert Pleroma.HTML.Scrubber.TwitterText == User.html_filter_policy(user)
end
end
+
+ describe "caching" do
+ test "invalidate_cache works" do
+ user = insert(:user)
+ user_info = User.get_cached_user_info(user)
+
+ User.invalidate_cache(user)
+
+ {:ok, nil} = Cachex.get(:user_cache, "ap_id:#{user.ap_id}")
+ {:ok, nil} = Cachex.get(:user_cache, "nickname:#{user.nickname}")
+ {:ok, nil} = Cachex.get(:user_cache, "user_info:#{user.id}")
+ end
+
+ test "User.delete() plugs any possible zombie objects" do
+ user = insert(:user)
+
+ {:ok, _} = User.delete(user)
+
+ {:ok, cached_user} = Cachex.get(:user_cache, "ap_id:#{user.ap_id}")
+
+ assert cached_user != user
+
+ {:ok, cached_user} = Cachex.get(:user_cache, "nickname:#{user.ap_id}")
+
+ assert cached_user != user
+ end
+ end
end