summaryrefslogtreecommitdiff
path: root/test/support/channel_case.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-12-18 19:49:01 +0100
committerlain <lain@soykaf.club>2020-12-18 19:53:19 +0100
commit95a9bdfc374a013be47e74b25bdba5d91f51948b (patch)
tree8c978c04055f71704ddf6f862effdf9462654a88 /test/support/channel_case.ex
parent713612c37725c81b0906b03528c9eaa474816c7d (diff)
downloadpleroma-95a9bdfc374a013be47e74b25bdba5d91f51948b.tar.gz
pleroma-95a9bdfc374a013be47e74b25bdba5d91f51948b.zip
Tests: Use NullCache for async tests.
Caching can't work in async tests, so for them it is mocked to a null cache that is always empty. Synchronous tests are stubbed with the real Cachex, which is emptied after every test.
Diffstat (limited to 'test/support/channel_case.ex')
-rw-r--r--test/support/channel_case.ex8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex
index 114184a9f..f4696adb3 100644
--- a/test/support/channel_case.ex
+++ b/test/support/channel_case.ex
@@ -33,8 +33,14 @@ defmodule Pleroma.Web.ChannelCase do
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
- unless tags[:async] do
+ if tags[:async] do
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache)
+ Mox.set_mox_private()
+ else
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy)
+ Mox.set_mox_global()
+ Pleroma.DataCase.clear_cachex()
end
:ok