summaryrefslogtreecommitdiff
path: root/test/web/twitter_api/util_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivant.business@gmail.com>2019-03-18 10:26:41 +0300
committerIvan Tashkinov <ivant.business@gmail.com>2019-03-18 10:26:41 +0300
commit2a96283efbd46c017cf9e15ef4fda3188e5e5bca (patch)
tree3265b9ff9f830a366d14870486c85ddcd08f51c9 /test/web/twitter_api/util_controller_test.exs
parent273905744242b013ba9736ff7e1415a0499022d1 (diff)
parent1344e34ed3a337b54e450af474f81e2f326bf768 (diff)
downloadpleroma-2a96283efbd46c017cf9e15ef4fda3188e5e5bca.tar.gz
pleroma-2a96283efbd46c017cf9e15ef4fda3188e5e5bca.zip
[#923] Merge remote-tracking branch 'remotes/upstream/develop' into twitter_oauth
# Conflicts: # config/config.exs # lib/pleroma/web/auth/pleroma_authenticator.ex
Diffstat (limited to 'test/web/twitter_api/util_controller_test.exs')
-rw-r--r--test/web/twitter_api/util_controller_test.exs22
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)