diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-03-02 22:02:21 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-03-02 22:02:21 +0300 |
commit | bd8624d649643c5a14bb24d8b2f2aed0454fb50d (patch) | |
tree | ba1369eaeca9debb0de143ddfb275d23f7d210ee /test/web/ostatus | |
parent | b4367125e9afc92ac27ff12552775f8e765140f1 (diff) | |
download | pleroma-bd8624d649643c5a14bb24d8b2f2aed0454fb50d.tar.gz |
[#1560] Added tests for non-federating instance bahaviour to OStatusControllerTest.
Diffstat (limited to 'test/web/ostatus')
-rw-r--r-- | test/web/ostatus/ostatus_controller_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/web/ostatus/ostatus_controller_test.exs index 50235dfef..2b7bc662d 100644 --- a/test/web/ostatus/ostatus_controller_test.exs +++ b/test/web/ostatus/ostatus_controller_test.exs @@ -277,4 +277,33 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do |> response(404) end end + + describe "when instance is not federating," do + clear_config([:instance, :federating]) do + Pleroma.Config.put([:instance, :federating], false) + end + + test "returns 404 for GET routes", %{conn: conn} do + conn = put_req_header(conn, "accept", "application/json") + + note_activity = insert(:note_activity, local: true) + [_, activity_uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["id"])) + + object = Object.normalize(note_activity) + [_, object_uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"])) + + get_uris = [ + "/activities/#{activity_uuid}", + "/objects/#{object_uuid}", + "/notice/#{note_activity.id}", + "/notice/#{note_activity.id}/embed_player" + ] + + for get_uri <- get_uris do + conn + |> get(get_uri) + |> json_response(404) + end + end + end end |