Merge remote-tracking branch 'pleroma/develop' into bugfix/apc2s_upload_activity
This commit is contained in:
commit
a8aa917530
15 changed files with 72 additions and 96 deletions
|
|
@ -667,7 +667,13 @@ defmodule Pleroma.NotificationTest do
|
|||
Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
|
||||
ObanHelpers.perform_all()
|
||||
|
||||
assert [] = Notification.for_user(follower)
|
||||
assert [
|
||||
%{
|
||||
activity: %{
|
||||
data: %{"type" => "Move", "actor" => ^old_ap_id, "target" => ^new_ap_id}
|
||||
}
|
||||
}
|
||||
] = Notification.for_user(follower)
|
||||
|
||||
assert [
|
||||
%{
|
||||
|
|
@ -675,17 +681,7 @@ defmodule Pleroma.NotificationTest do
|
|||
data: %{"type" => "Move", "actor" => ^old_ap_id, "target" => ^new_ap_id}
|
||||
}
|
||||
}
|
||||
] = Notification.for_user(follower, %{with_move: true})
|
||||
|
||||
assert [] = Notification.for_user(other_follower)
|
||||
|
||||
assert [
|
||||
%{
|
||||
activity: %{
|
||||
data: %{"type" => "Move", "actor" => ^old_ap_id, "target" => ^new_ap_id}
|
||||
}
|
||||
}
|
||||
] = Notification.for_user(other_follower, %{with_move: true})
|
||||
] = Notification.for_user(other_follower)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
Config.put([:rate_limit, limiter_name], {scale, limit})
|
||||
|
||||
plug_opts = RateLimiter.init(name: limiter_name)
|
||||
conn = conn(:get, "/")
|
||||
conn = build_conn(:get, "/")
|
||||
|
||||
for i <- 1..5 do
|
||||
conn = RateLimiter.call(conn, plug_opts)
|
||||
|
|
@ -65,7 +65,7 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
|
||||
Process.sleep(50)
|
||||
|
||||
conn = conn(:get, "/")
|
||||
conn = build_conn(:get, "/")
|
||||
|
||||
conn = RateLimiter.call(conn, plug_opts)
|
||||
assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)
|
||||
|
|
@ -85,7 +85,7 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
base_bucket_name = "#{limiter_name}:group1"
|
||||
plug_opts = RateLimiter.init(name: limiter_name, bucket_name: base_bucket_name)
|
||||
|
||||
conn = conn(:get, "/")
|
||||
conn = build_conn(:get, "/")
|
||||
|
||||
RateLimiter.call(conn, plug_opts)
|
||||
assert {1, 4} = RateLimiter.inspect_bucket(conn, base_bucket_name, plug_opts)
|
||||
|
|
@ -99,9 +99,9 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
|
||||
plug_opts = RateLimiter.init(name: limiter_name, params: ["id"])
|
||||
|
||||
conn = conn(:get, "/?id=1")
|
||||
conn = build_conn(:get, "/?id=1")
|
||||
conn = Plug.Conn.fetch_query_params(conn)
|
||||
conn_2 = conn(:get, "/?id=2")
|
||||
conn_2 = build_conn(:get, "/?id=2")
|
||||
|
||||
RateLimiter.call(conn, plug_opts)
|
||||
assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, plug_opts)
|
||||
|
|
@ -120,9 +120,9 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
|
||||
id = "100"
|
||||
|
||||
conn = conn(:get, "/?id=#{id}")
|
||||
conn = build_conn(:get, "/?id=#{id}")
|
||||
conn = Plug.Conn.fetch_query_params(conn)
|
||||
conn_2 = conn(:get, "/?id=#{101}")
|
||||
conn_2 = build_conn(:get, "/?id=#{101}")
|
||||
|
||||
RateLimiter.call(conn, plug_opts)
|
||||
assert {1, 4} = RateLimiter.inspect_bucket(conn, base_bucket_name, plug_opts)
|
||||
|
|
@ -138,8 +138,8 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
|
||||
plug_opts = RateLimiter.init(name: limiter_name)
|
||||
|
||||
conn = %{conn(:get, "/") | remote_ip: {127, 0, 0, 2}}
|
||||
conn_2 = %{conn(:get, "/") | remote_ip: {127, 0, 0, 3}}
|
||||
conn = %{build_conn(:get, "/") | remote_ip: {127, 0, 0, 2}}
|
||||
conn_2 = %{build_conn(:get, "/") | remote_ip: {127, 0, 0, 3}}
|
||||
|
||||
for i <- 1..5 do
|
||||
conn = RateLimiter.call(conn, plug_opts)
|
||||
|
|
@ -179,7 +179,7 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
plug_opts = RateLimiter.init(name: limiter_name)
|
||||
|
||||
user = insert(:user)
|
||||
conn = conn(:get, "/") |> assign(:user, user)
|
||||
conn = build_conn(:get, "/") |> assign(:user, user)
|
||||
|
||||
for i <- 1..5 do
|
||||
conn = RateLimiter.call(conn, plug_opts)
|
||||
|
|
@ -201,10 +201,10 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
plug_opts = RateLimiter.init(name: limiter_name)
|
||||
|
||||
user = insert(:user)
|
||||
conn = conn(:get, "/") |> assign(:user, user)
|
||||
conn = build_conn(:get, "/") |> assign(:user, user)
|
||||
|
||||
user_2 = insert(:user)
|
||||
conn_2 = conn(:get, "/") |> assign(:user, user_2)
|
||||
conn_2 = build_conn(:get, "/") |> assign(:user, user_2)
|
||||
|
||||
for i <- 1..5 do
|
||||
conn = RateLimiter.call(conn, plug_opts)
|
||||
|
|
@ -230,8 +230,8 @@ defmodule Pleroma.Plugs.RateLimiterTest do
|
|||
|
||||
opts = RateLimiter.init(name: limiter_name)
|
||||
|
||||
conn = conn(:get, "/")
|
||||
conn_2 = conn(:get, "/")
|
||||
conn = build_conn(:get, "/")
|
||||
conn_2 = build_conn(:get, "/")
|
||||
|
||||
%Task{pid: pid1} =
|
||||
task1 =
|
||||
|
|
|
|||
|
|
@ -1955,11 +1955,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
|
||||
activity = %Activity{activity | object: nil}
|
||||
|
||||
assert [%Notification{activity: ^activity}] =
|
||||
Notification.for_user(follower, %{with_move: true})
|
||||
assert [%Notification{activity: ^activity}] = Notification.for_user(follower)
|
||||
|
||||
assert [%Notification{activity: ^activity}] =
|
||||
Notification.for_user(follower_move_opted_out, %{with_move: true})
|
||||
assert [%Notification{activity: ^activity}] = Notification.for_user(follower_move_opted_out)
|
||||
end
|
||||
|
||||
test "old user must be in the new user's `also_known_as` list" do
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
|
|||
assert length(json_response(conn, 200)) == 1
|
||||
end
|
||||
|
||||
test "see move notifications with `with_move` parameter" do
|
||||
test "see move notifications" do
|
||||
old_user = insert(:user)
|
||||
new_user = insert(:user, also_known_as: [old_user.ap_id])
|
||||
%{user: follower, conn: conn} = oauth_access(["read:notifications"])
|
||||
|
|
@ -416,11 +416,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
|
|||
Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
|
||||
Pleroma.Tests.ObanHelpers.perform_all()
|
||||
|
||||
ret_conn = get(conn, "/api/v1/notifications")
|
||||
|
||||
assert json_response(ret_conn, 200) == []
|
||||
|
||||
conn = get(conn, "/api/v1/notifications", %{"with_move" => "true"})
|
||||
conn = get(conn, "/api/v1/notifications")
|
||||
|
||||
assert length(json_response(conn, 200)) == 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
|
|||
old_user = refresh_record(old_user)
|
||||
new_user = refresh_record(new_user)
|
||||
|
||||
[notification] = Notification.for_user(follower, %{with_move: true})
|
||||
[notification] = Notification.for_user(follower)
|
||||
|
||||
expected = %{
|
||||
id: to_string(notification.id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue