Merge remote-tracking branch 'pleroma/develop' into mastodon-lookup
authormarcin mikołajczak <git@mkljczk.pl>
Tue, 28 Dec 2021 15:27:27 +0000 (16:27 +0100)
committermarcin mikołajczak <git@mkljczk.pl>
Tue, 28 Dec 2021 15:27:27 +0000 (16:27 +0100)
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
1  2 
lib/pleroma/web/api_spec/operations/account_operation.ex
lib/pleroma/web/mastodon_api/controllers/account_controller.ex
lib/pleroma/web/router.ex
test/pleroma/web/mastodon_api/controllers/account_controller_test.exs

Simple merge
index 86349619e0fda677001388aeae8c0c33045ea0fe,966a4072d4665c92c42bd8a5247a62b49d05bb17..374e2048a732114a60c521bcd1a2073d24201a83
@@@ -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