[#1560] Ensured authentication or enabled federation for federation-related routes. New tests + tests refactoring.

This commit is contained in:
Ivan Tashkinov 2020-03-09 20:51:44 +03:00
commit 5fc92deef3
12 changed files with 418 additions and 404 deletions

View file

@ -48,6 +48,25 @@ defmodule Pleroma.Web.ConnCase do
%{user: user, token: token, conn: conn}
end
defp ensure_federating_or_authenticated(conn, url, user) do
Pleroma.Config.put([:instance, :federating], false)
conn
|> get(url)
|> response(403)
conn
|> assign(:user, user)
|> get(url)
|> response(200)
Pleroma.Config.put([:instance, :federating], true)
conn
|> get(url)
|> response(200)
end
end
end