Skip to content

Commit

Permalink
Clean up ct:log statements
Browse files Browse the repository at this point in the history
WIP address a dialyzer error
  • Loading branch information
MarcialRosales committed Sep 19, 2024
1 parent 28576a6 commit aa221a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
16 changes: 1 addition & 15 deletions deps/oauth2_client/src/oauth2_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
refresh_access_token/2,
get_oauth_provider/1, get_oauth_provider/2,
get_openid_configuration/2,
build_openid_discovery_endpoint/3, build_openid_discovery_endpoint/1,
build_openid_discovery_endpoint/2,
build_openid_discovery_endpoint/3,
merge_openid_configuration/2,
merge_oauth_provider/2,
extract_ssl_options_as_list/1,
Expand Down Expand Up @@ -49,17 +48,6 @@ refresh_access_token(OAuthProvider, Request) ->
append_paths(Path1, Path2) ->
erlang:iolist_to_binary([Path1, Path2]).

-spec build_openid_discovery_endpoint(Issuer :: uri_string:uri_string())
-> uri_string:uri_string().
build_openid_discovery_endpoint(Issuer) ->
build_openid_discovery_endpoint(Issuer, undefined, undefined).

-spec build_openid_discovery_endpoint(Issuer :: uri_string:uri_string(),
OpenIdConfigurationPath :: uri_string:uri_string() | undefined)
-> uri_string:uri_string().
build_openid_discovery_endpoint(Issuer, OpenIdConfigurationPath) ->
build_openid_discovery_endpoint(Issuer, OpenIdConfigurationPath, undefined).

-spec build_openid_discovery_endpoint(Issuer :: uri_string:uri_string(),
OpenIdConfigurationPath :: uri_string:uri_string() | undefined,
Params :: query_list()) -> uri_string:uri_string().
Expand All @@ -72,8 +60,6 @@ build_openid_discovery_endpoint(Issuer, OpenIdConfigurationPath, Params) ->
OpenIdPath = ensure_leading_path_separator(OpenIdConfigurationPath),
URLMap1 = URLMap0#{
path := case maps:get(path, URLMap0) of
"/" -> OpenIdPath;
"" -> OpenIdPath;
[] -> OpenIdPath;
P -> append_paths(drop_trailing_path_separator(P), OpenIdPath)
end
Expand Down
16 changes: 7 additions & 9 deletions deps/oauth2_client/test/system_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

-include_lib("oauth2_client.hrl").
-import(oauth2_client, [
build_openid_discovery_endpoint/1,
build_openid_discovery_endpoint/2]).
build_openid_discovery_endpoint/3]).

-compile(export_all).

Expand Down Expand Up @@ -150,7 +149,6 @@ init_per_group(_, Config) ->
get_http_oauth_server_expectations(TestCase, Config) ->
case ?config(TestCase, Config) of
undefined ->
ct:log("get_openid_configuration_http_expectation : ~p", [get_openid_configuration_http_expectation(TestCase)]),
[ {token_endpoint, build_http_mock_behaviour(build_http_access_token_request(),
build_http_200_access_token_response())},
{get_openid_configuration, get_openid_configuration_http_expectation(TestCase)}
Expand Down Expand Up @@ -247,7 +245,6 @@ init_per_testcase(TestCase, Config) ->

case ?config(group, Config) of
https ->
ct:log("Start https with expectations ~p", [ListOfExpectations]),
start_https_oauth_server(?AUTH_PORT, ?config(rmq_certsdir, Config),
ListOfExpectations);
_ ->
Expand Down Expand Up @@ -280,6 +277,12 @@ end_per_group(with_default_oauth_provider, Config) ->
end_per_group(_, Config) ->
Config.

build_openid_discovery_endpoint(Issuer) ->
build_openid_discovery_endpoint(Issuer, undefined, undefined).

build_openid_discovery_endpoint(Issuer, Path) ->
build_openid_discovery_endpoint(Issuer, Path, undefined).

get_openid_configuration(Config) ->
ExpectedOAuthProvider = ?config(oauth_provider, Config),
SslOptions = [{ssl, ExpectedOAuthProvider#oauth_provider.ssl_options}],
Expand Down Expand Up @@ -468,7 +471,6 @@ verify_get_oauth_provider_returns_default_oauth_provider(DefaultOAuthProviderId)
{ok, OAuthProvider2} =
oauth2_client:get_oauth_provider(DefaultOAuthProviderId,
[issuer, token_endpoint, jwks_uri]),
ct:log("verify_get_oauth_provider_returns_default_oauth_provider ~p vs ~p", [OAuthProvider1, OAuthProvider2]),
?assertEqual(OAuthProvider1, OAuthProvider2).

get_oauth_provider(Config) ->
Expand Down Expand Up @@ -622,8 +624,6 @@ start_https_oauth_server(Port, CertsDir, Expectations) when is_list(Expectations
{'_', [{Path, oauth_http_mock, Expected} || #{request := #{path := Path}}
= Expected <- Expectations ]}
]),
ct:log("start_https_oauth_server with expectation list : ~p -> dispatch: ~p",
[Expectations, Dispatch]),
{ok, _} = cowboy:start_tls(
mock_http_auth_listener,
[{port, Port},
Expand All @@ -634,8 +634,6 @@ start_https_oauth_server(Port, CertsDir, Expectations) when is_list(Expectations

start_https_oauth_server(Port, CertsDir, #{request := #{path := Path}} = Expected) ->
Dispatch = cowboy_router:compile([{'_', [{Path, oauth_http_mock, Expected}]}]),
ct:log("start_https_oauth_server with expectation : ~p -> dispatch: ~p",
[Expected, Dispatch]),
{ok, _} = cowboy:start_tls(
mock_http_auth_listener,
[{port, Port},
Expand Down

0 comments on commit aa221a9

Please sign in to comment.