Chat API: Align more to Pleroma/Mastodon API.
This commit is contained in:
parent
49e673dfea
commit
ad82a216ff
10 changed files with 22 additions and 34 deletions
|
|
@ -88,7 +88,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "POST /api/v1/pleroma/chats/by-ap-id/:id" do
|
||||
describe "POST /api/v1/pleroma/chats/by-account-id/:id" do
|
||||
setup do: oauth_access(["write:statuses"])
|
||||
|
||||
test "it creates or returns a chat", %{conn: conn} do
|
||||
|
|
@ -96,7 +96,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
|
|||
|
||||
result =
|
||||
conn
|
||||
|> post("/api/v1/pleroma/chats/by-ap-id/#{URI.encode_www_form(other_user.ap_id)}")
|
||||
|> post("/api/v1/pleroma/chats/by-account-id/#{other_user.id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert result["id"]
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageViewTest do
|
|||
|
||||
assert chat_message[:id] == object.id |> to_string()
|
||||
assert chat_message[:content] == "kippis :firefox:"
|
||||
assert chat_message[:actor] == user.ap_id
|
||||
assert chat_message[:actor_account_id] == user.id
|
||||
assert chat_message[:account_id] == user.id
|
||||
assert chat_message[:chat_id]
|
||||
assert chat_message[:created_at]
|
||||
assert match?([%{shortcode: "firefox"}], chat_message[:emojis])
|
||||
|
|
@ -39,8 +38,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageViewTest do
|
|||
|
||||
assert chat_message_two[:id] == object.id |> to_string()
|
||||
assert chat_message_two[:content] == "gkgkgk"
|
||||
assert chat_message_two[:actor] == recipient.ap_id
|
||||
assert chat_message_two[:actor_account_id] == recipient.id
|
||||
assert chat_message_two[:account_id] == recipient.id
|
||||
assert chat_message_two[:chat_id] == chat_message[:chat_id]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
|
|||
|
||||
assert represented_chat == %{
|
||||
id: "#{chat.id}",
|
||||
recipient: recipient.ap_id,
|
||||
recipient_account: AccountView.render("show.json", user: recipient),
|
||||
account: AccountView.render("show.json", user: recipient),
|
||||
unread: 0
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue