-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add institution info controller test
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
defmodule Web.InstitutionInfoControllerTest do | ||
use ExUnit.Case | ||
use Core.DataCase | ||
use Web.ConnCase | ||
|
||
import Web.Auth.Guardian | ||
import Core.Factory | ||
|
||
setup do | ||
institution = insert!(:institution_info) | ||
organizer = insert!(:user, role: :organizer) | ||
|
||
{:ok, institution: institution, organizer: organizer} | ||
end | ||
|
||
describe "show/2" do | ||
test "display institution info", %{organizer: organizer, institution: institution} do | ||
{:ok, token, _} = encode_and_sign(organizer, %{}, token_type: :access) | ||
|
||
conn = | ||
session_conn() | ||
|> put_session(:user_id, organizer.uuid) | ||
|> put_req_header("accept", "application/json") | ||
|> put_req_header("authorization", "Bearer " <> token) | ||
|> get(~p"/api/onboarding/institution_info") | ||
|
||
response = json_response(conn, 200)["data"] | ||
|
||
assert response == %{"name" => institution.name} | ||
end | ||
end | ||
end |