diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2019-07-07 08:58:24 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2019-07-07 08:58:24 +0200 |
commit | b5ba41a7255e23285810d865f0fef7701ab4ca6c (patch) | |
tree | de5c70861a764a8ead06007f80dc2772520f46c5 | |
parent | e174614eb9d9ea465611aac694912bbdbaf2a03c (diff) | |
download | pleroma-b5ba41a7255e23285810d865f0fef7701ab4ca6c.tar.gz |
mastodon_websocket_test.exs: Test for Sec-WebSocket-Protocol header
-rw-r--r-- | test/integration/mastodon_websocket_test.exs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/integration/mastodon_websocket_test.exs b/test/integration/mastodon_websocket_test.exs index a604713d8..3975cdcd6 100644 --- 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 |