Skip to content

Commit

Permalink
update test, #7
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Mar 6, 2020
1 parent ee12548 commit d4dc62f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/auth_mvp_web/controllers/person_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ defmodule AuthMvpWeb.PersonControllerTest do
test "Get /person/info returns person email when request header authorization is correct" do
assert {:ok, %Person{} = person} = AuthMvp.People.create_person(%{email: "person@dwyl.com"})
jwt = AuthMvp.Token.generate_and_sign!(%{email: "person@dwyl.com"})
conn = build_conn()
|> put_req_header("authorization", "Bearer #{jwt}")
|> get("/person/info")

assert json_response(conn, 200) == %{"data" => %{"email" => "person@dwyl.com"}}
conn =
build_conn()
|> put_req_header("authorization", "Bearer #{jwt}")
|> get("/person/info")

response = json_response(conn, 200)
assert response["data"]["email"] == "person@dwyl.com"
end
end

0 comments on commit d4dc62f

Please sign in to comment.