ChatController: Add GET /chats/:id

This commit is contained in:
lain 2020-05-10 13:26:14 +02:00
commit 8d5597ff68
6 changed files with 60 additions and 2 deletions

View file

@ -153,6 +153,23 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
end
end
describe "GET /api/v1/pleroma/chats/:id" do
setup do: oauth_access(["read:statuses"])
test "it returns a chat", %{conn: conn, user: user} do
other_user = insert(:user)
{:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id)
result =
conn
|> get("/api/v1/pleroma/chats/#{chat.id}")
|> json_response_and_validate_schema(200)
assert result["id"] == to_string(chat.id)
end
end
describe "GET /api/v1/pleroma/chats" do
setup do: oauth_access(["read:statuses"])