test: add test case for error when bridge name is too long
This commit is contained in:
parent
c2c87d276f
commit
375661c6a1
|
@ -415,6 +415,26 @@ t_http_crud_apis(Config) ->
|
|||
),
|
||||
|
||||
%% Test bad updates
|
||||
%% ================
|
||||
|
||||
%% Add bridge with a name that is too long
|
||||
%% We only support bridge names up to 255 characters
|
||||
LongName = list_to_binary(lists:duplicate(256, $a)),
|
||||
NameTooLongRequestResult = request_json(
|
||||
post,
|
||||
uri(["bridges"]),
|
||||
?HTTP_BRIDGE(URL1, LongName),
|
||||
Config
|
||||
),
|
||||
?assertMatch(
|
||||
{ok, 400, _},
|
||||
NameTooLongRequestResult
|
||||
),
|
||||
{ok, 400, #{<<"message">> := NameTooLongMessage}} = NameTooLongRequestResult,
|
||||
%% Use regex to check that the message contains the name
|
||||
Match = re:run(NameTooLongMessage, LongName),
|
||||
?assertMatch({match, _}, Match),
|
||||
%% Add bridge without the URL field
|
||||
{ok, 400, PutFail1} = request_json(
|
||||
put,
|
||||
uri(["bridges", BridgeID]),
|
||||
|
|
Loading…
Reference in New Issue