diff options
author | lain <lain@soykaf.club> | 2020-04-27 12:07:08 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-04-27 12:07:08 +0200 |
commit | c86143ed73ba5b2d8d373607ca706f1a428f3fe4 (patch) | |
tree | e86641043e676803ffc27a57ce23c29a71347063 /test/web/common_api/common_api_test.exs | |
parent | a51cdafc0192b66ce75659b424a690f52c9b2a49 (diff) | |
parent | 01cc93b6873b5c50c0fc54774a3b004bf660e46b (diff) | |
download | pleroma-c86143ed73ba5b2d8d373607ca706f1a428f3fe4.tar.gz |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 0f8860ec5..65bf55da1 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -98,6 +98,33 @@ defmodule Pleroma.Web.CommonAPITest do assert object.data["like_count"] == 20 end + test "repeating race condition" do + user = insert(:user) + users_serial = insert_list(10, :user) + users = insert_list(10, :user) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "."}) + + users_serial + |> Enum.map(fn user -> + CommonAPI.repeat(activity.id, user) + end) + + object = Object.get_by_ap_id(activity.data["object"]) + assert object.data["announcement_count"] == 10 + + users + |> Enum.map(fn user -> + Task.async(fn -> + CommonAPI.repeat(activity.id, user) + end) + end) + |> Enum.map(&Task.await/1) + + object = Object.get_by_ap_id(activity.data["object"]) + assert object.data["announcement_count"] == 20 + end + test "when replying to a conversation / participation, it will set the correct context id even if no explicit reply_to is given" do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "direct"}) |