diff --git a/config/test.exs b/config/test.exs
index 67ed4737f..412970d93 100644
--- a/config/test.exs
+++ b/config/test.exs
@@ -36,6 +36,7 @@
 config :pleroma, :websub, Pleroma.Web.WebsubMock
 config :pleroma, :ostatus, Pleroma.Web.OStatusMock
 config :tesla, adapter: Tesla.Mock
+config :pleroma, :rich_media, enabled: false
 
 config :web_push_encryption, :vapid_details,
   subject: "mailto:administrator@example.com",
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex
index c201d9a9b..ec5892ff5 100644
--- a/test/support/conn_case.ex
+++ b/test/support/conn_case.ex
@@ -33,6 +33,7 @@ defmodule Pleroma.Web.ConnCase do
 
   setup tags do
     Cachex.clear(:user_cache)
+    Cachex.clear(:object_cache)
     :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
 
     unless tags[:async] do
diff --git a/test/support/data_case.ex b/test/support/data_case.ex
index 56d5896ad..df260bd3f 100644
--- a/test/support/data_case.ex
+++ b/test/support/data_case.ex
@@ -32,6 +32,7 @@ defmodule Pleroma.DataCase do
 
   setup tags do
     Cachex.clear(:user_cache)
+    Cachex.clear(:object_cache)
     :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
 
     unless tags[:async] do
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 141d300c7..8528d4f64 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -137,6 +137,7 @@ test "posting a sensitive status", %{conn: conn} do
   end
 
   test "posting a status with OGP link preview", %{conn: conn} do
+    Pleroma.Config.put([:rich_media, :enabled], true)
     user = insert(:user)
 
     conn =
@@ -148,6 +149,7 @@ test "posting a status with OGP link preview", %{conn: conn} do
 
     assert %{"id" => id, "card" => %{"title" => "The Rock"}} = json_response(conn, 200)
     assert Repo.get(Activity, id)
+    Pleroma.Config.put([:rich_media, :enabled], false)
   end
 
   test "posting a direct status", %{conn: conn} do
@@ -1667,6 +1669,7 @@ test "max pinned statuses", %{conn: conn, user: user, activity: activity_one} do
     end
 
     test "Status rich-media Card", %{conn: conn, user: user} do
+      Pleroma.Config.put([:rich_media, :enabled], true)
       {:ok, activity} = CommonAPI.post(user, %{"status" => "http://example.com/ogp"})
 
       response =
@@ -1691,6 +1694,8 @@ test "Status rich-media Card", %{conn: conn, user: user} do
                  }
                }
              }
+
+      Pleroma.Config.put([:rich_media, :enabled], false)
     end
   end
 
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs
index 0c63dd84d..dbe5de2e2 100644
--- a/test/web/ostatus/ostatus_test.exs
+++ b/test/web/ostatus/ostatus_test.exs
@@ -530,6 +530,8 @@ test "Article objects are not representable" do
         note_object.data
         |> Map.put("type", "Article")
 
+      Cachex.clear(:object_cache)
+
       cs = Object.change(note_object, %{data: note_data})
       {:ok, _article_object} = Repo.update(cs)