aboutsummaryrefslogtreecommitdiff
path: root/test/migration_helper
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-11-12 12:34:48 +0000
committerrinpatch <rinpatch@sdf.org>2020-11-12 12:34:48 +0000
commit1172844ed18d94d84724dc6f11c6e9f72e0ba6ec (patch)
tree7d48a259e08856ab6db0eba255f20c0c19410463 /test/migration_helper
parenta0f5e8b27edbe2224d9c2c3997ad5b8ea484244b (diff)
parentb4c6b262d6dc12362f0014a864e8aed6c727c39c (diff)
downloadpleroma-2.2.0.tar.gz
Merge branch 'release/2.2.0' into 'stable'v2.2.0
Release/2.2.0 See merge request pleroma/secteam/pleroma!19
Diffstat (limited to 'test/migration_helper')
-rw-r--r--test/migration_helper/notification_backfill_test.exs56
1 files changed, 0 insertions, 56 deletions
diff --git a/test/migration_helper/notification_backfill_test.exs b/test/migration_helper/notification_backfill_test.exs
deleted file mode 100644
index 2a62a2b00..000000000
--- a/test/migration_helper/notification_backfill_test.exs
+++ /dev/null
@@ -1,56 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.MigrationHelper.NotificationBackfillTest do
- use Pleroma.DataCase
-
- alias Pleroma.Activity
- alias Pleroma.MigrationHelper.NotificationBackfill
- alias Pleroma.Notification
- alias Pleroma.Repo
- alias Pleroma.Web.CommonAPI
-
- import Pleroma.Factory
-
- describe "fill_in_notification_types" do
- test "it fills in missing notification types" do
- user = insert(:user)
- other_user = insert(:user)
-
- {:ok, post} = CommonAPI.post(user, %{status: "yeah, @#{other_user.nickname}"})
- {:ok, chat} = CommonAPI.post_chat_message(user, other_user, "yo")
- {:ok, react} = CommonAPI.react_with_emoji(post.id, other_user, "☕")
- {:ok, like} = CommonAPI.favorite(other_user, post.id)
- {:ok, react_2} = CommonAPI.react_with_emoji(post.id, other_user, "☕")
-
- data =
- react_2.data
- |> Map.put("type", "EmojiReaction")
-
- {:ok, react_2} =
- react_2
- |> Activity.change(%{data: data})
- |> Repo.update()
-
- assert {5, nil} = Repo.update_all(Notification, set: [type: nil])
-
- NotificationBackfill.fill_in_notification_types()
-
- assert %{type: "mention"} =
- Repo.get_by(Notification, user_id: other_user.id, activity_id: post.id)
-
- assert %{type: "favourite"} =
- Repo.get_by(Notification, user_id: user.id, activity_id: like.id)
-
- assert %{type: "pleroma:emoji_reaction"} =
- Repo.get_by(Notification, user_id: user.id, activity_id: react.id)
-
- assert %{type: "pleroma:emoji_reaction"} =
- Repo.get_by(Notification, user_id: user.id, activity_id: react_2.id)
-
- assert %{type: "pleroma:chat_mention"} =
- Repo.get_by(Notification, user_id: other_user.id, activity_id: chat.id)
- end
- end
-end