From dc2f0d3b53e41b0f0819bbc1ab5d668e7b70c5ca Mon Sep 17 00:00:00 2001 From: Ruby Iris Juric Date: Sat, 21 Sep 2024 16:07:13 +1000 Subject: [PATCH] Test cases for local_timeline_available option --- .../controllers/timeline_controller_test.exs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 3e7b6730c..523d115c9 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -409,7 +409,7 @@ test "should not return local-only posts for anonymous users" do assert [] = result end - test "should return 404 if disabled" do + test "should return 404 if federated timeline disabled" do clear_config([:instance, :federated_timeline_available], false) result = @@ -420,7 +420,26 @@ test "should return 404 if disabled" do assert %{"error" => "Federated timeline is disabled"} = result end - test "should not return 404 if local is specified" do + test "should not return 404 if local timeline disabled" do + clear_config([:instance, :local_timeline_available], false) + + build_conn() + |> get("/api/v1/timelines/public") + |> json_response_and_validate_schema(200) + end + + test "should return 404 if local is specified and local timeline disabled" do + clear_config([:instance, :local_timeline_available], false) + + result = + build_conn() + |> get("/api/v1/timelines/public?local=true") + |> json_response_and_validate_schema(404) + + assert %{"error" => "Local timeline is disabled"} = result + end + + test "should not return 404 if local is specified and federated timeline disabled" do clear_config([:instance, :federated_timeline_available], false) build_conn()