-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additionally I noticed that the eunit assert comparison args should be something like `_assertEqual(Expected, Value)` rather than the other way around. It helps make the test messages clearer.
- Loading branch information
Showing
1 changed file
with
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,7 @@ oauth_for({xoauth2, Account, {_, Provider}}) -> | |
-spec oauth_for(provider | email, binary(), [proplists:property()]) -> | ||
{ok, {ClientID :: string, ClientSecret :: string}} | {error, _}. | ||
oauth_for(provider, Provider, Providers) -> | ||
lager:warning("Providers: ~p", [Providers]), | ||
case proplists:get_value(Provider, Providers) of | ||
undefined -> | ||
{error, {no_provider_oauth, Provider}}; | ||
|
@@ -172,7 +173,7 @@ get_values([Key | Keys], List, Acc) -> | |
-include_lib("eunit/include/eunit.hrl"). | ||
|
||
get_values_test() -> | ||
[?assertEqual(get_values(Keys, List), Expected) | ||
[?assertEqual(Expected, get_values(Keys, List)) | ||
|| {Keys, List, Expected} | ||
<- [{[a], [{a, 1}, {b, 2}], {ok, [1]}}, | ||
{[b], [{a, 1}, {b, 2}], {ok, [2]}}, | ||
|
@@ -182,15 +183,15 @@ get_values_test() -> | |
]]. | ||
|
||
to_query_string_test() -> | ||
[?assertEqual(to_query_string(Props), Expected) | ||
[?assertEqual(Expected, to_query_string(Props)) | ||
|| {Props, Expected} | ||
<- [ | ||
{ [{a, <<"1234">>}], <<"a=1234&">> }, | ||
{ [{a, <<"1234">>}, {b, <<"token">>}], <<"a=1234&b=token&">> } | ||
]]. | ||
|
||
oauth_for_test() -> | ||
[?assertEqual(oauth_for(provider, Account, Providers), Expected) | ||
[?assertEqual(Expected, oauth_for(email, Account, Providers)) | ||
|| {Account, Providers, Expected} | ||
<- [ | ||
{<<"[email protected]">>, [{google, prov}], {ok, prov}}, | ||
|