Clear caches on test.

This commit is contained in:
lain 2018-03-22 12:44:32 +01:00
parent f9ab38a443
commit 32ae918843
3 changed files with 3 additions and 4 deletions

View File

@ -28,6 +28,7 @@ defmodule Pleroma.Web.ConnCase do
setup tags do setup tags do
Cachex.clear(:user_cache)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo) :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
unless tags[:async] do unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()}) Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})

View File

@ -26,6 +26,7 @@ defmodule Pleroma.DataCase do
end end
setup tags do setup tags do
Cachex.clear(:user_cache)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo) :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
unless tags[:async] do unless tags[:async] do

View File

@ -58,10 +58,7 @@ test "contains mentions" do
incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml") incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml")
# a user with this ap id might be in the cache. # a user with this ap id might be in the cache.
recipient = "https://pleroma.soykaf.com/users/lain" recipient = "https://pleroma.soykaf.com/users/lain"
user = User.get_cached_by_ap_id(recipient) || insert(:user, %{ap_id: recipient}) user = insert(:user, %{ap_id: recipient})
# invalidate the cache
User.invalidate_cache(user)
{:ok, [activity]} = OStatus.handle_incoming(incoming) {:ok, [activity]} = OStatus.handle_incoming(incoming)