MediaControllerTest: Fix test.
This commit is contained in:
parent
3cce929eec
commit
2c10843bc4
|
@ -6,8 +6,10 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
|
||||||
use Pleroma.Web.ConnCase
|
use Pleroma.Web.ConnCase
|
||||||
|
|
||||||
import ExUnit.CaptureLog
|
import ExUnit.CaptureLog
|
||||||
|
import Mox
|
||||||
|
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
|
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
|
|
||||||
|
@ -15,6 +17,9 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
|
||||||
setup do: oauth_access(["write:media"])
|
setup do: oauth_access(["write:media"])
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
|
ConfigMock
|
||||||
|
|> stub_with(Pleroma.Test.StaticConfig)
|
||||||
|
|
||||||
image = %Plug.Upload{
|
image = %Plug.Upload{
|
||||||
content_type: "image/jpeg",
|
content_type: "image/jpeg",
|
||||||
path: Path.absname("test/fixtures/image.jpg"),
|
path: Path.absname("test/fixtures/image.jpg"),
|
||||||
|
@ -145,6 +150,9 @@ test "Do not allow nested filename", %{conn: conn, image: image} do
|
||||||
setup do: oauth_access(["write:media"])
|
setup do: oauth_access(["write:media"])
|
||||||
|
|
||||||
setup %{user: actor} do
|
setup %{user: actor} do
|
||||||
|
ConfigMock
|
||||||
|
|> stub_with(Pleroma.Test.StaticConfig)
|
||||||
|
|
||||||
file = %Plug.Upload{
|
file = %Plug.Upload{
|
||||||
content_type: "image/jpeg",
|
content_type: "image/jpeg",
|
||||||
path: Path.absname("test/fixtures/image.jpg"),
|
path: Path.absname("test/fixtures/image.jpg"),
|
||||||
|
@ -177,6 +185,9 @@ test "/api/v1/media/:id good request", %{conn: conn, object: object} do
|
||||||
setup do: oauth_access(["read:media"])
|
setup do: oauth_access(["read:media"])
|
||||||
|
|
||||||
setup %{user: actor} do
|
setup %{user: actor} do
|
||||||
|
ConfigMock
|
||||||
|
|> stub_with(Pleroma.Test.StaticConfig)
|
||||||
|
|
||||||
file = %Plug.Upload{
|
file = %Plug.Upload{
|
||||||
content_type: "image/jpeg",
|
content_type: "image/jpeg",
|
||||||
path: Path.absname("test/fixtures/image.jpg"),
|
path: Path.absname("test/fixtures/image.jpg"),
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
end)
|
end)
|
||||||
|
|
||||||
defmodule Pleroma.Test.StaticConfig do
|
defmodule Pleroma.Test.StaticConfig do
|
||||||
|
@moduledoc """
|
||||||
|
This module provides a Config that is completely static, built at startup time from the environment. It's safe to use in testing as it will not modify any state.
|
||||||
|
"""
|
||||||
|
|
||||||
@behaviour Pleroma.Config.Getting
|
@behaviour Pleroma.Config.Getting
|
||||||
@config Application.get_all_env(:pleroma)
|
@config Application.get_all_env(:pleroma)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue