logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

activity_draft_test.exs (1625B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.CommonAPI.ActivityDraftTest do
  5. use Pleroma.DataCase
  6. alias Pleroma.Web.CommonAPI
  7. alias Pleroma.Web.CommonAPI.ActivityDraft
  8. import Pleroma.Factory
  9. test "create/2 with a quote post" do
  10. user = insert(:user)
  11. another_user = insert(:user)
  12. {:ok, direct} = CommonAPI.post(user, %{status: ".", visibility: "direct"})
  13. {:ok, private} = CommonAPI.post(user, %{status: ".", visibility: "private"})
  14. {:ok, unlisted} = CommonAPI.post(user, %{status: ".", visibility: "unlisted"})
  15. {:ok, local} = CommonAPI.post(user, %{status: ".", visibility: "local"})
  16. {:ok, public} = CommonAPI.post(user, %{status: ".", visibility: "public"})
  17. {:error, _} = ActivityDraft.create(user, %{status: "nice", quote_id: direct.id})
  18. {:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: private.id})
  19. {:error, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: private.id})
  20. {:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: unlisted.id})
  21. {:ok, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: unlisted.id})
  22. {:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: local.id})
  23. {:ok, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: local.id})
  24. {:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: public.id})
  25. {:ok, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: public.id})
  26. end
  27. end