Skip to content

Commit

Permalink
Fixing error in oauth_for test
Browse files Browse the repository at this point in the history
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
jtmoulia committed Apr 27, 2015
1 parent 63925ff commit e5d6a0f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/switchboard_oauth.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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}};
Expand Down Expand Up @@ -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]}},
Expand All @@ -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}},
Expand Down

0 comments on commit e5d6a0f

Please sign in to comment.