Unbreak all the tests.

This commit is contained in:
lain 2019-02-03 18:54:39 +01:00
parent 505a084058
commit e61f0be951
5 changed files with 10 additions and 0 deletions

View File

@ -36,6 +36,7 @@ config :pbkdf2_elixir, rounds: 1
config :pleroma, :websub, Pleroma.Web.WebsubMock config :pleroma, :websub, Pleroma.Web.WebsubMock
config :pleroma, :ostatus, Pleroma.Web.OStatusMock config :pleroma, :ostatus, Pleroma.Web.OStatusMock
config :tesla, adapter: Tesla.Mock config :tesla, adapter: Tesla.Mock
config :pleroma, :rich_media, enabled: false
config :web_push_encryption, :vapid_details, config :web_push_encryption, :vapid_details,
subject: "mailto:administrator@example.com", subject: "mailto:administrator@example.com",

View File

@ -33,6 +33,7 @@ defmodule Pleroma.Web.ConnCase do
setup tags do setup tags do
Cachex.clear(:user_cache) Cachex.clear(:user_cache)
Cachex.clear(:object_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

@ -32,6 +32,7 @@ defmodule Pleroma.DataCase do
setup tags do setup tags do
Cachex.clear(:user_cache) Cachex.clear(:user_cache)
Cachex.clear(:object_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

@ -137,6 +137,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end end
test "posting a status with OGP link preview", %{conn: conn} do test "posting a status with OGP link preview", %{conn: conn} do
Pleroma.Config.put([:rich_media, :enabled], true)
user = insert(:user) user = insert(:user)
conn = conn =
@ -148,6 +149,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert %{"id" => id, "card" => %{"title" => "The Rock"}} = json_response(conn, 200) assert %{"id" => id, "card" => %{"title" => "The Rock"}} = json_response(conn, 200)
assert Repo.get(Activity, id) assert Repo.get(Activity, id)
Pleroma.Config.put([:rich_media, :enabled], false)
end end
test "posting a direct status", %{conn: conn} do test "posting a direct status", %{conn: conn} do
@ -1667,6 +1669,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end end
test "Status rich-media Card", %{conn: conn, user: user} do 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"}) {:ok, activity} = CommonAPI.post(user, %{"status" => "http://example.com/ogp"})
response = response =
@ -1691,6 +1694,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
} }
} }
} }
Pleroma.Config.put([:rich_media, :enabled], false)
end end
end end

View File

@ -530,6 +530,8 @@ defmodule Pleroma.Web.OStatusTest do
note_object.data note_object.data
|> Map.put("type", "Article") |> Map.put("type", "Article")
Cachex.clear(:object_cache)
cs = Object.change(note_object, %{data: note_data}) cs = Object.change(note_object, %{data: note_data})
{:ok, _article_object} = Repo.update(cs) {:ok, _article_object} = Repo.update(cs)