Skip to content

Commit

Permalink
Updates tests
Browse files Browse the repository at this point in the history
  • Loading branch information
silvagustin committed Apr 27, 2021
1 parent c9f1ba8 commit a775f7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/ueberauth/strategy/auth0/oauth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ defmodule Ueberauth.Strategy.Auth0.OAuth do

defp compute_configs(conn, configs) do
case conn do
%Plug.Conn{} = conn ->
%Plug.Conn{} = conn when not is_nil(configs) ->
with module when is_atom(module) <- Keyword.get(configs, :config_from),
true <- function_exported?(module, :get_domain, 1),
true <- function_exported?(module, :get_client_id, 1),
Expand Down
8 changes: 5 additions & 3 deletions test/strategy/auth0/oauth_test.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
defmodule Ueberauth.Strategy.Auth0.OAuthTest do
use ExUnit.Case

import Ueberauth.Strategy.Auth0.OAuth, only: [client: 0, client: 1]
import Ueberauth.Strategy.Auth0.OAuth, only: [client: 1, client: 2]

@test_domain "example-app.auth0.com"

setup do
{:ok, %{client: client()}}
conn = %Plug.Conn{}
{:ok, %{client: client(conn)}}
end

test "creates correct client", %{client: client} do
Expand All @@ -21,7 +22,8 @@ defmodule Ueberauth.Strategy.Auth0.OAuthTest do

test "raises when there is no configuration" do
assert_raise(RuntimeError, ~r/^Expected to find settings under.*/, fn ->
client(otp_app: :unknown_auth0_otp_app)
conn = %Plug.Conn{}
client(conn, otp_app: :unknown_auth0_otp_app)
end)
end
end

0 comments on commit a775f7e

Please sign in to comment.