Guest User

Untitled

a guest
Feb 23rd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. defmodule Core.Test.Authenticator do
  2. use Core.ConnCase
  3.  
  4. @spec authenticate(String.t, String.t) :: Plug.Conn.t
  5. def authenticate(username, password) do
  6. conn = conn() |> put_req_header("accept", "application/json")
  7. authed_conn = post conn, auth_path(conn, :login), username: username, password: password
  8. conn = put_req_header(conn, "x-auth-token", json_response(authed_conn, 200)["data"]["token"])
  9. end
  10. end
Add Comment
Please, Sign In to add comment