Merge remote-tracking branch 'origin/develop' into translation-provider-translatelocally
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
commit
13bc4ba639
38 changed files with 418 additions and 147 deletions
|
|
@ -1881,6 +1881,11 @@ defmodule Pleroma.UserTest do
|
|||
end
|
||||
end
|
||||
|
||||
test "get_or_fetch_public_key_for_ap_id fetches a user that's not in the db" do
|
||||
assert {:ok, _key} =
|
||||
User.get_or_fetch_public_key_for_ap_id("http://mastodon.example.org/users/admin")
|
||||
end
|
||||
|
||||
test "get_public_key_for_ap_id returns correctly for user that's not in the db" do
|
||||
assert :error = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -332,6 +332,33 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
)
|
||||
end
|
||||
|
||||
test "activity with BCC is published to a list member." do
|
||||
actor = insert(:user)
|
||||
{:ok, list} = Pleroma.List.create("list", actor)
|
||||
list_member = insert(:user, %{local: false})
|
||||
|
||||
Pleroma.List.follow(list, list_member)
|
||||
|
||||
note_activity =
|
||||
insert(:note_activity,
|
||||
# recipients: [follower.ap_id],
|
||||
data_attrs: %{"bcc" => [list.ap_id]}
|
||||
)
|
||||
|
||||
res = Publisher.publish(actor, note_activity)
|
||||
assert res == :ok
|
||||
|
||||
assert_enqueued(
|
||||
worker: "Pleroma.Workers.PublisherWorker",
|
||||
args: %{
|
||||
"params" => %{
|
||||
inbox: list_member.inbox,
|
||||
activity_id: note_activity.id
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
test "publishes a delete activity to peers who signed fetch requests to the create acitvity/object." do
|
||||
fetcher =
|
||||
insert(:user,
|
||||
|
|
|
|||
|
|
@ -282,6 +282,21 @@ defmodule Pleroma.Web.Feed.UserControllerTest do
|
|||
"#{Pleroma.Web.Endpoint.url()}/users/#{user.nickname}/feed.atom"
|
||||
end
|
||||
|
||||
test "redirects to rss feed when explicitly requested", %{conn: conn} do
|
||||
note_activity = insert(:note_activity)
|
||||
user = User.get_cached_by_ap_id(note_activity.data["actor"])
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("accept", "application/xml")
|
||||
|> get("/users/#{user.nickname}.rss")
|
||||
|
||||
assert conn.status == 302
|
||||
|
||||
assert redirected_to(conn) ==
|
||||
"#{Pleroma.Web.Endpoint.url()}/users/#{user.nickname}/feed.rss"
|
||||
end
|
||||
|
||||
test "with non-html / non-json format, it returns error when user is not found", %{conn: conn} do
|
||||
response =
|
||||
conn
|
||||
|
|
|
|||
|
|
@ -2134,7 +2134,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
assert %{"id" => ^id1, "endorsed" => true} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/accounts/#{id1}/pin")
|
||||
|> post("/api/v1/accounts/#{id1}/endorse")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [%{"id" => ^id1}] =
|
||||
|
|
@ -2153,7 +2153,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
assert %{"id" => ^id1, "endorsed" => false} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/accounts/#{id1}/unpin")
|
||||
|> post("/api/v1/accounts/#{id1}/unendorse")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [] =
|
||||
|
|
@ -2172,15 +2172,40 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/accounts/#{id1}/pin")
|
||||
|> post("/api/v1/accounts/#{id1}/endorse")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert %{"error" => "You have already pinned the maximum number of users"} =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/accounts/#{id2}/pin")
|
||||
|> post("/api/v1/accounts/#{id2}/endorse")
|
||||
|> json_response_and_validate_schema(400)
|
||||
end
|
||||
|
||||
test "returns a list of pinned accounts", %{conn: conn} do
|
||||
clear_config([:instance, :max_endorsed_users], 3)
|
||||
|
||||
%{id: id1} = user1 = insert(:user)
|
||||
%{id: id2} = user2 = insert(:user)
|
||||
%{id: id3} = user3 = insert(:user)
|
||||
|
||||
CommonAPI.follow(user2, user1)
|
||||
CommonAPI.follow(user3, user1)
|
||||
|
||||
User.endorse(user1, user2)
|
||||
User.endorse(user1, user3)
|
||||
|
||||
[%{"id" => ^id2}, %{"id" => ^id3}] =
|
||||
conn
|
||||
|> get("/api/v1/accounts/#{id1}/endorsements")
|
||||
|> json_response_and_validate_schema(200)
|
||||
end
|
||||
|
||||
test "returns 404 error when specified user is not exist", %{conn: conn} do
|
||||
conn = get(conn, "/api/v1/accounts/test/endorsements")
|
||||
|
||||
assert json_response_and_validate_schema(conn, 404) == %{"error" => "Record not found"}
|
||||
end
|
||||
end
|
||||
|
||||
describe "familiar followers" do
|
||||
|
|
|
|||
|
|
@ -194,4 +194,28 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
|
|||
refute Map.has_key?(result["pleroma"]["metadata"]["base_urls"], "media_proxy")
|
||||
refute Map.has_key?(result["pleroma"]["metadata"]["base_urls"], "upload")
|
||||
end
|
||||
|
||||
test "display timeline access restrictions", %{conn: conn} do
|
||||
clear_config([:restrict_unauthenticated, :timelines, :local], true)
|
||||
clear_config([:restrict_unauthenticated, :timelines, :federated], false)
|
||||
|
||||
conn = get(conn, "/api/v2/instance")
|
||||
|
||||
assert result = json_response_and_validate_schema(conn, 200)
|
||||
|
||||
assert result["configuration"]["timelines_access"] == %{
|
||||
"live_feeds" => %{
|
||||
"local" => "authenticated",
|
||||
"remote" => "public"
|
||||
},
|
||||
"hashtag_feeds" => %{
|
||||
"local" => "authenticated",
|
||||
"remote" => "public"
|
||||
},
|
||||
"trending_link_feeds" => %{
|
||||
"local" => "disabled",
|
||||
"remote" => "disabled"
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -280,35 +280,6 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "account endorsements" do
|
||||
test "returns a list of pinned accounts", %{conn: conn} do
|
||||
%{id: id1} = user1 = insert(:user)
|
||||
%{id: id2} = user2 = insert(:user)
|
||||
%{id: id3} = user3 = insert(:user)
|
||||
|
||||
CommonAPI.follow(user2, user1)
|
||||
CommonAPI.follow(user3, user1)
|
||||
|
||||
User.endorse(user1, user2)
|
||||
User.endorse(user1, user3)
|
||||
|
||||
response =
|
||||
conn
|
||||
|> get("/api/v1/pleroma/accounts/#{id1}/endorsements")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert length(response) == 2
|
||||
assert Enum.any?(response, fn user -> user["id"] == id2 end)
|
||||
assert Enum.any?(response, fn user -> user["id"] == id3 end)
|
||||
end
|
||||
|
||||
test "returns 404 error when specified user is not exist", %{conn: conn} do
|
||||
conn = get(conn, "/api/v1/pleroma/accounts/test/endorsements")
|
||||
|
||||
assert json_response_and_validate_schema(conn, 404) == %{"error" => "Record not found"}
|
||||
end
|
||||
end
|
||||
|
||||
describe "birthday reminders" do
|
||||
test "returns a list of friends having birthday on specified day" do
|
||||
%{user: user, conn: conn} = oauth_access(["read:accounts"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue