summaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
Diffstat (limited to 'test/support')
-rw-r--r--test/support/captcha/mock.ex (renamed from test/support/captcha_mock.ex)0
-rw-r--r--test/support/channel_case.ex2
-rw-r--r--test/support/conn_case.ex25
-rw-r--r--test/support/factory.ex2
-rw-r--r--test/support/oban_helpers.ex3
-rw-r--r--test/support/web_push_http_client_mock.ex23
6 files changed, 7 insertions, 48 deletions
diff --git a/test/support/captcha_mock.ex b/test/support/captcha/mock.ex
index 2ed2ba3b4..2ed2ba3b4 100644
--- a/test/support/captcha_mock.ex
+++ b/test/support/captcha/mock.ex
diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex
index d63a0f06b..114184a9f 100644
--- a/test/support/channel_case.ex
+++ b/test/support/channel_case.ex
@@ -22,7 +22,7 @@ defmodule Pleroma.Web.ChannelCase do
using do
quote do
# Import conveniences for testing with channels
- use Phoenix.ChannelTest
+ import Phoenix.ChannelTest
use Pleroma.Tests.Helpers
# The default endpoint for testing
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex
index 7ef681258..47cb65a80 100644
--- a/test/support/conn_case.ex
+++ b/test/support/conn_case.ex
@@ -22,7 +22,8 @@ defmodule Pleroma.Web.ConnCase do
using do
quote do
# Import conveniences for testing with connections
- use Phoenix.ConnTest
+ import Plug.Conn
+ import Phoenix.ConnTest
use Pleroma.Tests.Helpers
import Pleroma.Web.Router.Helpers
@@ -111,28 +112,6 @@ defmodule Pleroma.Web.ConnCase do
defp json_response_and_validate_schema(conn, _status) do
flunk("Response schema not found for #{conn.method} #{conn.request_path} #{conn.status}")
end
-
- defp ensure_federating_or_authenticated(conn, url, user) do
- initial_setting = Config.get([:instance, :federating])
- on_exit(fn -> Config.put([:instance, :federating], initial_setting) end)
-
- Config.put([:instance, :federating], false)
-
- conn
- |> get(url)
- |> response(403)
-
- conn
- |> assign(:user, user)
- |> get(url)
- |> response(200)
-
- Config.put([:instance, :federating], true)
-
- conn
- |> get(url)
- |> response(200)
- end
end
end
diff --git a/test/support/factory.ex b/test/support/factory.ex
index fb82be0c4..80b882ee4 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -31,7 +31,7 @@ defmodule Pleroma.Factory do
nickname: sequence(:nickname, &"nick#{&1}"),
password_hash: Pbkdf2.hash_pwd_salt("test"),
bio: sequence(:bio, &"Tester Number #{&1}"),
- discoverable: true,
+ is_discoverable: true,
last_digest_emailed_at: NaiveDateTime.utc_now(),
last_refreshed_at: NaiveDateTime.utc_now(),
notification_settings: %Pleroma.User.NotificationSetting{},
diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex
index 9f90a821c..2468f66dc 100644
--- a/test/support/oban_helpers.ex
+++ b/test/support/oban_helpers.ex
@@ -7,6 +7,8 @@ defmodule Pleroma.Tests.ObanHelpers do
Oban test helpers.
"""
+ require Ecto.Query
+
alias Pleroma.Repo
def wipe_all do
@@ -15,6 +17,7 @@ defmodule Pleroma.Tests.ObanHelpers do
def perform_all do
Oban.Job
+ |> Ecto.Query.where(state: "available")
|> Repo.all()
|> perform()
end
diff --git a/test/support/web_push_http_client_mock.ex b/test/support/web_push_http_client_mock.ex
deleted file mode 100644
index 3cd12957d..000000000
--- a/test/support/web_push_http_client_mock.ex
+++ /dev/null
@@ -1,23 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.WebPushHttpClientMock do
- def get(url, headers \\ [], options \\ []) do
- {
- res,
- %Tesla.Env{status: status}
- } = Pleroma.HTTP.request(:get, url, "", headers, options)
-
- {res, %{status_code: status}}
- end
-
- def post(url, body, headers \\ [], options \\ []) do
- {
- res,
- %Tesla.Env{status: status}
- } = Pleroma.HTTP.request(:post, url, body, headers, options)
-
- {res, %{status_code: status}}
- end
-end