-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from alejandrodevs/master
Add the option to get the client secret dynamically.
- Loading branch information
Showing
4 changed files
with
42 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
defmodule Ueberauth.Strategy.Google.OAuthTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Ueberauth.Strategy.Google.OAuth | ||
|
||
defmodule MyApp.Google do | ||
def client_secret(_opts), do: "custom_client_secret" | ||
end | ||
|
||
describe "client/1" do | ||
test "uses client secret in the config when it is not a tuple" do | ||
assert %OAuth2.Client{client_secret: "client_secret"} = OAuth.client() | ||
end | ||
|
||
test "generates client secret when it is using a tuple config" do | ||
options = [client_secret: {MyApp.Google, :client_secret}] | ||
assert %OAuth2.Client{client_secret: "custom_client_secret"} = OAuth.client(options) | ||
end | ||
end | ||
end |