test: test authz against 'single' mogodb

This commit is contained in:
Zaiming (Stone) Shi 2022-01-04 00:25:09 +01:00
parent 6c99b64e4c
commit 7b478817bd
2 changed files with 9 additions and 3 deletions

View File

@ -38,8 +38,8 @@
}).
-define(SOURCE2, #{<<"type">> => <<"mongodb">>,
<<"enable">> => true,
<<"mongo_type">> => <<"sharded">>,
<<"servers">> => <<"127.0.0.1:27017,192.168.0.1:27017">>,
<<"mongo_type">> => <<"single">>,
<<"server">> => <<"127.0.0.1:27017">>,
<<"pool_size">> => 1,
<<"database">> => <<"mqtt">>,
<<"ssl">> => #{<<"enable">> => false},
@ -160,6 +160,13 @@ end_per_testcase(_, _Config) -> ok.
%%------------------------------------------------------------------------------
%% Testcases
%%------------------------------------------------------------------------------
t_mongodb_connectivity(_) ->
Type = single,
Hosts = ["127.0.0.1:27017", "192.168.0.1:27017"],
TopologyOpts = [{pool_size, 1}],
WorkerOpts = [{database, <<"mqtt">>}, {ssl, false}],
{ok, Pid} = mongo_api:connect(Type, Hosts, TopologyOpts, WorkerOpts),
?assertEqual(undefined, mongo_api:find_one(Pid, <<"foo">>, #{<<"key">> => 123}, #{})).
t_api(_) ->
{ok, 200, Result1} = request(get, uri(["authorization", "sources"]), []),

View File

@ -26,7 +26,6 @@
-export([ lookup/1
, get_metrics/1
, list_all/0
, make_test_id/0
]).
-export([ hash_call/2