diff options
author | lain <lain@soykaf.club> | 2020-04-23 13:33:30 +0200 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-05-01 00:55:34 +0300 |
commit | 2e58fe08cd5035e66d34c87f70588f8a307d51ed (patch) | |
tree | f9eb9557c91547d55e4b55bcb9832049c07bfe23 /test/web/common_api/common_api_test.exs | |
parent | 6e0b046771304bb8b733cebecc20a31a4df5e616 (diff) | |
download | pleroma-2e58fe08cd5035e66d34c87f70588f8a307d51ed.tar.gz pleroma-2e58fe08cd5035e66d34c87f70588f8a307d51ed.zip |
CommonAPI: Don't make repeating announces possible
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 9b7fce3a0..9fe8fc0f3 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -268,6 +268,16 @@ defmodule Pleroma.Web.CommonAPITest do {:ok, %Activity{}, _} = CommonAPI.repeat(activity.id, user) end + test "can't repeat a repeat" do + user = insert(:user) + other_user = insert(:user) + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + + {:ok, %Activity{} = announce, _} = CommonAPI.repeat(activity.id, other_user) + + refute match?({:ok, %Activity{}, _}, CommonAPI.repeat(announce.id, user)) + end + test "repeating a status privately" do user = insert(:user) other_user = insert(:user) @@ -294,8 +304,8 @@ defmodule Pleroma.Web.CommonAPITest do other_user = insert(:user) {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) - {:ok, %Activity{} = activity, object} = CommonAPI.repeat(activity.id, user) - {:ok, ^activity, ^object} = CommonAPI.repeat(activity.id, user) + {:ok, %Activity{} = announce, object} = CommonAPI.repeat(activity.id, user) + {:ok, ^announce, ^object} = CommonAPI.repeat(activity.id, user) end test "favoriting a status twice returns the status" do @@ -369,7 +379,9 @@ defmodule Pleroma.Web.CommonAPITest do user = refresh_record(user) - assert {:ok, ^activity} = CommonAPI.unpin(activity.id, user) + id = activity.id + + assert match?({:ok, %{id: ^id}}, CommonAPI.unpin(activity.id, user)) user = refresh_record(user) |