-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run "mix format" to keep SourceLevel happy #85 (comment)
- Loading branch information
Showing
18 changed files
with
128 additions
and
108 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
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ defmodule AuthWeb.PingController do | |
def ping(conn, params) do | ||
Ping.render_pixel(conn, params) | ||
end | ||
end | ||
end |
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
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 |
---|---|---|
|
@@ -17,11 +17,10 @@ defmodule AuthWeb.PeopleRolesTest do | |
test "attempt to grant_role/3 without admin should 401", %{conn: conn} do | ||
alex = %{email: "[email protected]", auth_provider: "email"} | ||
grantee = Auth.Person.create_person(alex) | ||
conn = assign(conn, :person, grantee) # | ||
conn = assign(conn, :person, grantee) | ||
role_id = 4 | ||
conn = Auth.PeopleRoles.grant_role(conn, grantee.id, role_id) | ||
|
||
assert conn.status == 401 | ||
end | ||
|
||
end | ||
end |
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 |
---|---|---|
|
@@ -22,8 +22,10 @@ defmodule AuthWeb.AuthControllerTest do | |
} | ||
|
||
person = Auth.Person.create_person(data) | ||
conn = AuthPlug.create_jwt_session(conn, Map.merge(data, %{id: person.id})) | ||
|> get("/profile", %{}) | ||
|
||
conn = | ||
AuthPlug.create_jwt_session(conn, Map.merge(data, %{id: person.id})) | ||
|> get("/profile", %{}) | ||
|
||
assert html_response(conn, 200) =~ "Google account" | ||
end | ||
|
@@ -50,19 +52,20 @@ defmodule AuthWeb.AuthControllerTest do | |
end | ||
|
||
test "get_client_secret(client_id, state) gets the secret for the given client_id" do | ||
person = | ||
Auth.Person.create_person(%{ | ||
email: "[email protected]", | ||
auth_provider: "email" | ||
}) | ||
|
||
person = Auth.Person.create_person(%{ | ||
email: "[email protected]", | ||
auth_provider: "email" | ||
}) | ||
|
||
{:ok, key} = %{"name" => "test key", "url" => "example.com"} | ||
|> AuthWeb.ApikeyController.make_apikey(person.id) | ||
|> Auth.Apikey.create_apikey() | ||
{:ok, key} = | ||
%{"name" => "test key", "url" => "example.com"} | ||
|> AuthWeb.ApikeyController.make_apikey(person.id) | ||
|> Auth.Apikey.create_apikey() | ||
|
||
state = "https://www.example.com/profile?auth_client_id=#{key.client_id}" | ||
secret = AuthWeb.AuthController.get_client_secret(key.client_id, state) | ||
|
||
assert secret == key.client_secret | ||
end | ||
|
||
|
@@ -126,8 +129,9 @@ defmodule AuthWeb.AuthControllerTest do | |
|
||
person = Auth.Person.upsert_person(data) | ||
|
||
conn = AuthPlug.create_jwt_session(conn, person) | ||
|> get("/auth/google/callback", %{"code" => "234", "state" => nil}) | ||
conn = | ||
AuthPlug.create_jwt_session(conn, person) | ||
|> get("/auth/google/callback", %{"code" => "234", "state" => nil}) | ||
|
||
assert html_response(conn, 200) =~ "Google account" | ||
end | ||
|
Oops, something went wrong.