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