test(authz): fix test suite for schema check and app start
This commit is contained in:
parent
effa3b8b90
commit
a58493f7a4
|
@ -73,6 +73,9 @@ authorize(Client, PubSub, Topic,
|
||||||
ignore
|
ignore
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
parse_url(URL)
|
||||||
|
when URL =:= undefined ->
|
||||||
|
#{};
|
||||||
parse_url(URL) ->
|
parse_url(URL) ->
|
||||||
{ok, URIMap} = emqx_http_lib:uri_parse(URL),
|
{ok, URIMap} = emqx_http_lib:uri_parse(URL),
|
||||||
case maps:get(query, URIMap, undefined) of
|
case maps:get(query, URIMap, undefined) of
|
||||||
|
|
|
@ -199,6 +199,9 @@ transform_header_name(Headers) ->
|
||||||
maps:put(K, V, Acc)
|
maps:put(K, V, Acc)
|
||||||
end, #{}, Headers).
|
end, #{}, Headers).
|
||||||
|
|
||||||
|
check_ssl_opts(Conf)
|
||||||
|
when Conf =:= #{} ->
|
||||||
|
true;
|
||||||
check_ssl_opts(Conf) ->
|
check_ssl_opts(Conf) ->
|
||||||
case emqx_authz_http:parse_url(hocon_schema:get_value("config.url", Conf)) of
|
case emqx_authz_http:parse_url(hocon_schema:get_value("config.url", Conf)) of
|
||||||
#{scheme := https} ->
|
#{scheme := https} ->
|
||||||
|
@ -210,6 +213,9 @@ check_ssl_opts(Conf) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
check_headers(Conf)
|
||||||
|
when Conf =:= #{} ->
|
||||||
|
true;
|
||||||
check_headers(Conf) ->
|
check_headers(Conf) ->
|
||||||
Method = to_bin(hocon_schema:get_value("config.method", Conf)),
|
Method = to_bin(hocon_schema:get_value("config.method", Conf)),
|
||||||
Headers = hocon_schema:get_value("config.headers", Conf),
|
Headers = hocon_schema:get_value("config.headers", Conf),
|
||||||
|
|
|
@ -36,7 +36,8 @@ init_per_suite(Config) ->
|
||||||
meck:expect(emqx_resource, remove, fun(_) -> ok end ),
|
meck:expect(emqx_resource, remove, fun(_) -> ok end ),
|
||||||
|
|
||||||
ok = emqx_common_test_helpers:start_apps(
|
ok = emqx_common_test_helpers:start_apps(
|
||||||
[emqx_conf, emqx_authz], fun set_special_configs/1),
|
[emqx_connector, emqx_conf, emqx_authz],
|
||||||
|
fun set_special_configs/1),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
|
|
Loading…
Reference in New Issue