|
|
@@ -151,6 +151,32 @@ t_update(_) ->
|
|
|
ResponseMap = emqx_json:decode(Response, [return_maps]),
|
|
|
?assertEqual(1, erlang:length(ResponseMap)),
|
|
|
|
|
|
+ BadBody1 = #{topic => ?TOPIC_S},
|
|
|
+ ?assertMatch(
|
|
|
+ {error, {"HTTP/1.1", 400, "Bad Request"}},
|
|
|
+ emqx_mgmt_api_test_util:request_api(put, Path, "", Auth, BadBody1)
|
|
|
+ ),
|
|
|
+ BadBody2 = [#{topic => ?TOPIC_S, qos => 3}],
|
|
|
+ ?assertMatch(
|
|
|
+ {error, {"HTTP/1.1", 400, "Bad Request"}},
|
|
|
+ emqx_mgmt_api_test_util:request_api(put, Path, "", Auth, BadBody2)
|
|
|
+ ),
|
|
|
+ BadBody3 = [#{topic => ?TOPIC_S, rh => 10}],
|
|
|
+ ?assertMatch(
|
|
|
+ {error, {"HTTP/1.1", 400, "Bad Request"}},
|
|
|
+ emqx_mgmt_api_test_util:request_api(put, Path, "", Auth, BadBody3)
|
|
|
+ ),
|
|
|
+ BadBody4 = [#{topic => ?TOPIC_S, rap => -1}],
|
|
|
+ ?assertMatch(
|
|
|
+ {error, {"HTTP/1.1", 400, "Bad Request"}},
|
|
|
+ emqx_mgmt_api_test_util:request_api(put, Path, "", Auth, BadBody4)
|
|
|
+ ),
|
|
|
+ BadBody5 = [#{topic => ?TOPIC_S, nl => -1}],
|
|
|
+ ?assertMatch(
|
|
|
+ {error, {"HTTP/1.1", 400, "Bad Request"}},
|
|
|
+ emqx_mgmt_api_test_util:request_api(put, Path, "", Auth, BadBody5)
|
|
|
+ ),
|
|
|
+
|
|
|
{ok, Client} = emqtt:start_link(#{username => ?CLIENT_USERNAME, clientid => ?CLIENT_ID}),
|
|
|
{ok, _} = emqtt:connect(Client),
|
|
|
timer:sleep(100),
|