X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fintegration%2Fmastodon_websocket_test.exs;h=3975cdcd694b3a39bc14ebce532b89faaa021b55;hb=4948117fcf297efa735cdafb9cddf39946668266;hp=a604713d800ec83407049116282c78a49ad733b3;hpb=c34327b22e6e01e9e162ec93217f8ce2352204ac;p=akkoma 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