diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-08-15 18:30:20 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-08-15 18:30:20 +0300 |
commit | 60ac83a4c196233ed13c3da9ca296b0a4224e9a3 (patch) | |
tree | fd26e163248392904d100f2413399372f090c4c2 /test | |
parent | 95529ab709b14acbf0b4ef2c17a76e0540e1e84e (diff) | |
download | pleroma-60ac83a4c196233ed13c3da9ca296b0a4224e9a3.tar.gz |
[#2046] Added test for pleroma/restrict_unauthenticated defaults on private instance. Updated docs and changelog.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/timeline_controller_test.exs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs index 50e0d783d..71bac99f7 100644 --- a/test/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs @@ -445,6 +445,23 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do assert length(json_response(res_conn, 200)) == 2 end + test "with default settings on private instances, returns 403 for unauthenticated users", %{ + conn: conn, + base_uri: base_uri, + error_response: error_response + } do + clear_config([:instance, :public], false) + clear_config([:restrict_unauthenticated, :timelines]) + + for local <- [true, false] do + res_conn = get(conn, "#{base_uri}?local=#{local}") + + assert json_response(res_conn, :unauthorized) == error_response + end + + ensure_authenticated_access(base_uri) + end + test "with `%{local: true, federated: true}`, returns 403 for unauthenticated users", %{ conn: conn, base_uri: base_uri, |