mastodon_websocket_test.exs: Test for Sec-WebSocket-Protocol header

This commit is contained in:
Haelwenn (lanodan) Monnier 2019-07-07 08:58:24 +02:00
parent e174614eb9
commit b5ba41a725
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
1 changed files with 7 additions and 0 deletions

View File

@ -107,5 +107,12 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
assert {:ok, _} = start_socket("?stream=user:notification&access_token=#{token.token}")
assert {:error, {403, "Forbidden"}} = start_socket("?stream=user:notification")
end
test "accepts valid token on Sec-WebSocket-Protocol header", %{token: token} do
assert {:ok, _} = start_socket("?stream=user", [{"Sec-WebSocket-Protocol", token.token}])
assert {:error, {403, "Forbidden"}} =
start_socket("?stream=user", [{"Sec-WebSocket-Protocol", "I am a friend"}])
end
end
end