logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: b5ba41a7255e23285810d865f0fef7701ab4ca6c
parent: e174614eb9d9ea465611aac694912bbdbaf2a03c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun,  7 Jul 2019 08:58:24 +0200

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

Diffstat:

Mtest/integration/mastodon_websocket_test.exs7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/test/integration/mastodon_websocket_test.exs b/test/integration/mastodon_websocket_test.exs @@ -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