summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/notification_test.exs7
-rw-r--r--test/support/builders/activity_builder.ex2
-rw-r--r--test/support/httpoison_mock.ex6
-rw-r--r--test/web/twitter_api/twitter_api_controller_test.exs4
4 files changed, 14 insertions, 5 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs
index 568ad642c..2ca1ac13d 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -33,6 +33,13 @@ defmodule Pleroma.NotificationTest do
assert nil == Notification.create_notification(activity, user)
end
+
+ test "it doesn't create a notification for user if he is the activity author" do
+ activity = insert(:note_activity)
+ author = User.get_by_ap_id(activity.data["actor"])
+
+ assert nil == Notification.create_notification(activity, author)
+ end
end
describe "get notification" do
diff --git a/test/support/builders/activity_builder.ex b/test/support/builders/activity_builder.ex
index d9c188955..eb72d5ba9 100644
--- a/test/support/builders/activity_builder.ex
+++ b/test/support/builders/activity_builder.ex
@@ -26,7 +26,7 @@ defmodule Pleroma.Builders.ActivityBuilder do
end
def insert_list(times, data \\ %{}, opts \\ %{}) do
- Enum.map(1..times, fn n ->
+ Enum.map(1..times, fn _n ->
{:ok, activity} = insert(data, opts)
activity
end)
diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex
index ba35c4460..4a5a9ea85 100644
--- a/test/support/httpoison_mock.ex
+++ b/test/support/httpoison_mock.ex
@@ -367,7 +367,7 @@ defmodule HTTPoisonMock do
def post(
"https://social.heldscal.la/main/push/hub",
- {:form, data},
+ {:form, _data},
"Content-type": "application/x-www-form-urlencoded"
) do
{:ok,
@@ -711,11 +711,11 @@ defmodule HTTPoisonMock do
}"}
end
- def post(url, body, headers) do
+ def post(url, _body, _headers) do
{:error, "Not implemented the mock response for post #{inspect(url)}"}
end
- def post(url, body, headers, options) do
+ def post(url, _body, _headers, _options) do
{:error, "Not implemented the mock response for post #{inspect(url)}"}
end
end
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs
index d7113979a..896fe246d 100644
--- a/test/web/twitter_api/twitter_api_controller_test.exs
+++ b/test/web/twitter_api/twitter_api_controller_test.exs
@@ -257,8 +257,10 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
end
test "with credentials", %{conn: conn, user: current_user} do
+ other_user = insert(:user)
+
{:ok, activity} =
- ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: current_user})
+ ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user})
conn =
conn