diff options
author | eugenijm <eugenijm@protonmail.com> | 2019-03-15 20:06:28 +0300 |
---|---|---|
committer | eugenijm <eugenijm@protonmail.com> | 2019-03-15 23:56:14 +0300 |
commit | 43fb03be5a8968c1df23938ed4f5a93825ab476c (patch) | |
tree | 31b8bc6913a212c1739aa6b27feec0c8ac1b16bf /test | |
parent | 4b3c86c1a61a029202a262229c713cc3737b2a1b (diff) | |
download | pleroma-43fb03be5a8968c1df23938ed4f5a93825ab476c.tar.gz |
Allow to mark a single notification as read
Diffstat (limited to 'test')
-rw-r--r-- | test/web/twitter_api/util_controller_test.exs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index fc762ab18..6e8a25056 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/web/twitter_api/util_controller_test.exs @@ -1,6 +1,9 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do use Pleroma.Web.ConnCase + alias Pleroma.Notification + alias Pleroma.Repo + alias Pleroma.Web.CommonAPI import Pleroma.Factory describe "POST /api/pleroma/follow_import" do @@ -52,6 +55,25 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do end end + describe "POST /api/pleroma/notifications/read" do + test "it marks a single notification as read", %{conn: conn} do + user1 = insert(:user) + user2 = insert(:user) + {:ok, activity1} = CommonAPI.post(user2, %{"status" => "hi @#{user1.nickname}"}) + {:ok, activity2} = CommonAPI.post(user2, %{"status" => "hi @#{user1.nickname}"}) + {:ok, [notification1]} = Notification.create_notifications(activity1) + {:ok, [notification2]} = Notification.create_notifications(activity2) + + conn + |> assign(:user, user1) + |> post("/api/pleroma/notifications/read", %{"id" => "#{notification1.id}"}) + |> json_response(:ok) + + assert Repo.get(Notification, notification1.id).seen + refute Repo.get(Notification, notification2.id).seen + end + end + describe "GET /api/statusnet/config.json" do test "it returns the managed config", %{conn: conn} do Pleroma.Config.put([:instance, :managed_config], false) |