diff options
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 6 | ||||
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 8 | ||||
-rw-r--r-- | test/web/twitter_api/views/notification_view_test.exs | 22 |
3 files changed, 23 insertions, 13 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 060ebe9f1..3dab59746 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -102,7 +102,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do user = insert(:user) data = - File.read!("test/fixtures/mastodon-follow-activity.json") |> Poison.decode!() + File.read!("test/fixtures/mastodon-follow-activity.json") + |> Poison.decode!() |> Map.put("object", user.ap_id) {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) @@ -118,7 +119,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do {:ok, activity} = CommonAPI.post(user, %{"status" => "hello"}) data = - File.read!("test/fixtures/mastodon-like.json") |> Poison.decode!() + File.read!("test/fixtures/mastodon-like.json") + |> Poison.decode!() |> Map.put("object", activity.data["object"]["id"]) {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 18a3243f5..406dace1c 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -270,10 +270,10 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert length(response) == 1 assert response == - NotificationView.render( - "notification.json", - %{notifications: Notification.for_user(current_user), for: current_user} - ) + NotificationView.render("notification.json", %{ + notifications: Notification.for_user(current_user), + for: current_user + }) end end diff --git a/test/web/twitter_api/views/notification_view_test.exs b/test/web/twitter_api/views/notification_view_test.exs index 33aaa89e1..e3b140657 100644 --- a/test/web/twitter_api/views/notification_view_test.exs +++ b/test/web/twitter_api/views/notification_view_test.exs @@ -36,14 +36,17 @@ defmodule Pleroma.Web.TwitterAPI.NotificationViewTest do "ntype" => "follow" } - assert represented == NotificationView.render("notification.json", %{notification: follow_notif, for: user}) + assert represented == + NotificationView.render("notification.json", %{notification: follow_notif, for: user}) end test "A mention notification" do user = insert(:user) other_user = insert(:user) - {:ok, activity} = TwitterAPI.create_status(other_user, %{"status" => "Päivää, @#{user.nickname}"}) + {:ok, activity} = + TwitterAPI.create_status(other_user, %{"status" => "Päivää, @#{user.nickname}"}) + [notification] = Notification.for_user(user) represented = %{ @@ -55,7 +58,8 @@ defmodule Pleroma.Web.TwitterAPI.NotificationViewTest do "ntype" => "mention" } - assert represented == NotificationView.render("notification.json", %{notification: notification, for: user}) + assert represented == + NotificationView.render("notification.json", %{notification: notification, for: user}) end test "A retweet notification" do @@ -71,11 +75,13 @@ defmodule Pleroma.Web.TwitterAPI.NotificationViewTest do "from_profile" => UserView.render("show.json", %{user: repeater, for: user}), "id" => notification.id, "is_seen" => 0, - "notice" => ActivityView.render("activity.json", %{activity: notification.activity, for: user}), + "notice" => + ActivityView.render("activity.json", %{activity: notification.activity, for: user}), "ntype" => "repeat" } - assert represented == NotificationView.render("notification.json", %{notification: notification, for: user}) + assert represented == + NotificationView.render("notification.json", %{notification: notification, for: user}) end test "A like notification" do @@ -91,10 +97,12 @@ defmodule Pleroma.Web.TwitterAPI.NotificationViewTest do "from_profile" => UserView.render("show.json", %{user: liker, for: user}), "id" => notification.id, "is_seen" => 0, - "notice" => ActivityView.render("activity.json", %{activity: notification.activity, for: user}), + "notice" => + ActivityView.render("activity.json", %{activity: notification.activity, for: user}), "ntype" => "like" } - assert represented == NotificationView.render("notification.json", %{notification: notification, for: user}) + assert represented == + NotificationView.render("notification.json", %{notification: notification, for: user}) end end |