-
Notifications
You must be signed in to change notification settings - Fork 43
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 #36 from dwyl/export-testdouble-issue#35
Export TestDouble issue #35
- Loading branch information
Showing
8 changed files
with
68 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export GOOGLE_CLIENT_ID=YourAppsClientId.apps.googleusercontent.com | ||
export GOOGLE_CLIENT_SECRET=SuperSecret | ||
export SECRET_KEY_BASE=2PzB7PPnpuLsbWmWtXpGyI+kfSQSQ1zUW2Atz/+8PdZuSEJzHgzGnJWV35nTKRwx | ||
export ENCRYPTION_KEYS='nMdayQpR0aoasLaq1g94FLba+A+wB44JLko47sVQXMg=,L+ZVX8iheoqgqb22mUpATmMDsvVGtafoAeb0KN5uWf0=' |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
defmodule ElixirAuthGoogle.HTTPoisonMock do | ||
@moduledoc """ | ||
This is a TestDouble for HTTPoison which returns a predictable response. | ||
Please see: https://github.com/dwyl/elixir-auth-google/issues/35 | ||
""" | ||
|
||
@doc """ | ||
get/1 passing in the wrong_token is used to test failure in the auth process. | ||
Obviously, don't invoke it from your App unless you want people to see fails. | ||
""" | ||
def get("https://www.googleapis.com/oauth2/v3/userinfo?access_token=wrong_token") do | ||
{:error, :bad_request} | ||
end | ||
|
||
@doc """ | ||
get/1 using a dummy _url to test body decoding. | ||
""" | ||
def get(_url) do | ||
{:ok, %{body: Poison.encode!( | ||
%{ | ||
email: "nelson@gmail.com", | ||
email_verified: true, | ||
family_name: "Correia", | ||
given_name: "Nelson", | ||
locale: "en", | ||
name: "Nelson Correia", | ||
picture: "https://lh3.googleusercontent.com/a-/AAuE7mApnYb260YC1JY7a", | ||
sub: "940732358705212133793" | ||
} | ||
)}} | ||
end | ||
|
||
@doc """ | ||
post/2 passing in dummy _url & _body to test return of access_token. | ||
""" | ||
def post(_url, _body) do | ||
{:ok, %{body: Poison.encode!(%{access_token: "token1"})}} | ||
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