Fix lint errors

This commit is contained in:
Sean King 2022-03-20 17:26:07 -06:00
parent d0c1997d48
commit 4194559ea6
No known key found for this signature in database
GPG key ID: 510C52BACD6E7257
2 changed files with 18 additions and 7 deletions

View file

@ -34,15 +34,22 @@ def start_socket(qs \\ nil, headers \\ []) do
test "refuses invalid requests" do
capture_log(fn ->
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 404}} = start_socket()
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 404}} = start_socket("?stream=ncjdk")
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 404}} =
start_socket("?stream=ncjdk")
Process.sleep(30)
end)
end
test "requires authentication and a valid token for protected streams" do
capture_log(fn ->
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} = start_socket("?stream=user&access_token=aaaaaaaaaaaa")
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} = start_socket("?stream=user")
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} =
start_socket("?stream=user&access_token=aaaaaaaaaaaa")
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} =
start_socket("?stream=user")
Process.sleep(30)
end)
end
@ -102,7 +109,9 @@ test "accepts the 'user' stream", %{token: token} = _state do
assert {:ok, _} = start_socket("?stream=user&access_token=#{token.token}")
capture_log(fn ->
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} = start_socket("?stream=user")
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} =
start_socket("?stream=user")
Process.sleep(30)
end)
end
@ -111,7 +120,9 @@ test "accepts the 'user:notification' stream", %{token: token} = _state do
assert {:ok, _} = start_socket("?stream=user:notification&access_token=#{token.token}")
capture_log(fn ->
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} = start_socket("?stream=user:notification")
assert {:error, %Mint.WebSocket.UpgradeFailureError{status_code: 401}} =
start_socket("?stream=user:notification")
Process.sleep(30)
end)
end