Skip to content

Commit a1dea77

Browse files
committed
Add more tests with invalid input
1 parent 7d1ffd4 commit a1dea77

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

deps/rabbitmq_auth_backend_ldap/test/system_SUITE.erl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,44 @@ validate_ldap_configuration_via_api(Config) ->
386386
'servers' => ["localhost"],
387387
'port' => LdapPort
388388
}, ?UNPROCESSABLE_ENTITY),
389+
390+
%% Invalid field values tests
391+
%% Invalid port - string instead of number
392+
http_put(Config, "/ldap/validate/simple-bind",
393+
#{
394+
'user_dn' => AliceUserDN,
395+
'password' => Password,
396+
'servers' => ["localhost"],
397+
'port' => "not_a_number"
398+
}, ?BAD_REQUEST),
399+
400+
%% Invalid port - negative number
401+
http_put(Config, "/ldap/validate/simple-bind",
402+
#{
403+
'user_dn' => AliceUserDN,
404+
'password' => Password,
405+
'servers' => ["localhost"],
406+
'port' => -1
407+
}, ?BAD_REQUEST),
408+
409+
%% Invalid boolean - string instead of boolean
410+
http_put(Config, "/ldap/validate/simple-bind",
411+
#{
412+
'user_dn' => AliceUserDN,
413+
'password' => Password,
414+
'servers' => ["localhost"],
415+
'port' => LdapPort,
416+
'use_ssl' => "maybe"
417+
}, ?BAD_REQUEST),
418+
419+
%% Invalid servers - non-list value
420+
http_put(Config, "/ldap/validate/simple-bind",
421+
#{
422+
'user_dn' => AliceUserDN,
423+
'password' => Password,
424+
'servers' => "not_a_list",
425+
'port' => LdapPort
426+
}, ?BAD_REQUEST),
389427
http_put(Config, "/ldap/validate/simple-bind",
390428
#{
391429
'user_dn' => AliceUserDN,

0 commit comments

Comments
 (0)