Created
November 16, 2016 16:54
-
-
Save johanb/ff999170748051ea6f1a456d00df4489 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Kreuwel.Channels.UserSocketTest do | |
use Kreuwel.ChannelCase | |
import Kreuwel.TestFactory | |
alias Kreuwel.UserSocket | |
test "socket authentication with valid token" do | |
user = insert(:user) | |
{:ok, jwt, _} = Guardian.encode_and_sign(user) | |
assert {:ok, socket} = UserSocket.connect(%{"guardian_token" => "#{jwt}"}, %Phoenix.Socket{}) | |
end | |
test "socket authentication without token" do | |
assert :error = UserSocket.connect(%{}, %Phoenix.Socket{}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment