2022-01-26 10:21:49 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.CommonAPI.ActivityDraftTest do
|
|
|
|
use Pleroma.DataCase
|
|
|
|
|
|
|
|
alias Pleroma.Web.CommonAPI
|
|
|
|
alias Pleroma.Web.CommonAPI.ActivityDraft
|
|
|
|
|
|
|
|
import Pleroma.Factory
|
|
|
|
|
|
|
|
test "create/2 with a quote post" do
|
|
|
|
user = insert(:user)
|
2023-07-10 16:27:23 -06:00
|
|
|
another_user = insert(:user)
|
2022-01-26 10:21:49 -07:00
|
|
|
|
|
|
|
{:ok, direct} = CommonAPI.post(user, %{status: ".", visibility: "direct"})
|
|
|
|
{:ok, private} = CommonAPI.post(user, %{status: ".", visibility: "private"})
|
|
|
|
{:ok, unlisted} = CommonAPI.post(user, %{status: ".", visibility: "unlisted"})
|
2023-07-10 16:27:23 -06:00
|
|
|
{:ok, local} = CommonAPI.post(user, %{status: ".", visibility: "local"})
|
2022-01-26 10:21:49 -07:00
|
|
|
{:ok, public} = CommonAPI.post(user, %{status: ".", visibility: "public"})
|
|
|
|
|
|
|
|
{:error, _} = ActivityDraft.create(user, %{status: "nice", quote_id: direct.id})
|
2023-07-10 16:27:23 -06:00
|
|
|
{:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: private.id})
|
|
|
|
{:error, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: private.id})
|
2022-01-26 10:21:49 -07:00
|
|
|
{:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: unlisted.id})
|
2023-07-10 16:27:23 -06:00
|
|
|
{:ok, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: unlisted.id})
|
|
|
|
{:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: local.id})
|
|
|
|
{:ok, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: local.id})
|
2022-01-26 10:21:49 -07:00
|
|
|
{:ok, _} = ActivityDraft.create(user, %{status: "nice", quote_id: public.id})
|
2023-07-10 16:27:23 -06:00
|
|
|
{:ok, _} = ActivityDraft.create(another_user, %{status: "nice", quote_id: public.id})
|
2022-01-26 10:21:49 -07:00
|
|
|
end
|
|
|
|
end
|