From: marcin mikołajczak Date: Tue, 28 Dec 2021 15:27:27 +0000 (+0100) Subject: Merge remote-tracking branch 'pleroma/develop' into mastodon-lookup X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=746c9daa62d591b0559768251889cccb025e7db0;p=akkoma Merge remote-tracking branch 'pleroma/develop' into mastodon-lookup Signed-off-by: marcin mikołajczak --- 746c9daa62d591b0559768251889cccb025e7db0 diff --cc test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 86349619e,966a4072d..374e2048a --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@@ -1777,27 -1798,20 +1798,44 @@@ defmodule Pleroma.Web.MastodonAPI.Accou assert [%{"id" => ^id2}] = result end + test "account lookup", %{conn: conn} do + %{nickname: acct} = insert(:user, %{nickname: "nickname"}) + %{nickname: acct_two} = insert(:user, %{nickname: "nickname@notlocaldoma.in"}) + + result = + conn + |> get("/api/v1/accounts/lookup?acct=#{acct}") + |> json_response_and_validate_schema(200) + + assert %{"acct" => ^acct} = result + + result = + conn + |> get("/api/v1/accounts/lookup?acct=#{acct_two}") + |> json_response_and_validate_schema(200) + + assert %{"acct" => ^acct_two} = result + + _result = + conn + |> get("/api/v1/accounts/lookup?acct=unexisting_nickname") + |> json_response_and_validate_schema(404) + end ++ + test "create a note on a user" do + %{conn: conn} = oauth_access(["write:accounts", "read:follows"]) + other_user = insert(:user) + + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/accounts/#{other_user.id}/note", %{ + "comment" => "Example note" + }) + + assert [%{"note" => "Example note"}] = + conn + |> put_req_header("content-type", "application/json") + |> get("/api/v1/accounts/relationships?id=#{other_user.id}") + |> json_response_and_validate_schema(200) + end end