X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fscheduled_activity_test.exs;h=dcf12fb490eca71ffa8f3324800199cff9e9fed2;hb=af9aa8e35809561a3edbd79ed1adb7de31056f38;hp=c49c65c0acb31c329aa109d9d960c67c4c77feec;hpb=fc92a0fd8d5be0352f4791b79bda04960f36f707;p=akkoma diff --git a/test/scheduled_activity_test.exs b/test/scheduled_activity_test.exs index c49c65c0a..dcf12fb49 100644 --- a/test/scheduled_activity_test.exs +++ b/test/scheduled_activity_test.exs @@ -1,18 +1,14 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors +# Copyright © 2017-2019 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ScheduledActivityTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.DataCase alias Pleroma.ScheduledActivity - alias Pleroma.Web.ActivityPub.ActivityPub import Pleroma.Factory setup context do - Config.put([ScheduledActivity, :daily_user_limit], 2) - Config.put([ScheduledActivity, :total_user_limit], 3) DataCase.ensure_local_uploader(context) end @@ -42,7 +38,7 @@ defmodule Pleroma.ScheduledActivityTest do tomorrow = NaiveDateTime.utc_now() - |> NaiveDateTime.add(:timer.hours(24), :millisecond) + |> NaiveDateTime.add(:timer.hours(36), :millisecond) |> NaiveDateTime.to_iso8601() {:ok, _} = ScheduledActivity.create(user, %{params: %{}, scheduled_at: today}) @@ -64,30 +60,5 @@ defmodule Pleroma.ScheduledActivityTest do {:error, changeset} = ScheduledActivity.create(user, attrs) assert changeset.errors == [scheduled_at: {"must be at least 5 minutes from now", []}] end - - test "excludes attachments belonging to another user" do - user = insert(:user) - another_user = insert(:user) - - scheduled_at = - NaiveDateTime.utc_now() - |> NaiveDateTime.add(:timer.minutes(10), :millisecond) - |> NaiveDateTime.to_iso8601() - - file = %Plug.Upload{ - content_type: "image/jpg", - path: Path.absname("test/fixtures/image.jpg"), - filename: "an_image.jpg" - } - - {:ok, user_upload} = ActivityPub.upload(file, actor: user.ap_id) - {:ok, another_user_upload} = ActivityPub.upload(file, actor: another_user.ap_id) - - media_ids = [user_upload.id, another_user_upload.id] - attrs = %{params: %{"media_ids" => media_ids}, scheduled_at: scheduled_at} - {:ok, scheduled_activity} = ScheduledActivity.create(user, attrs) - assert to_string(user_upload.id) in scheduled_activity.params["media_ids"] - refute to_string(another_user_upload.id) in scheduled_activity.params["media_ids"] - end end end