File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -477,3 +477,33 @@ def test_send_msg_discord(default_conf, mocker):
477477 assert "title" in msg_mock .call_args_list [0 ][0 ][0 ]["embeds" ][0 ]
478478 assert "color" in msg_mock .call_args_list [0 ][0 ][0 ]["embeds" ][0 ]
479479 assert "fields" in msg_mock .call_args_list [0 ][0 ][0 ]["embeds" ][0 ]
480+
481+
482+ def test_nested_payload_format (default_conf , mocker ):
483+ webhook_config = {
484+ "enabled" : True ,
485+ "url" : "https://example.com" ,
486+ "format" : "json" ,
487+ "status" : {
488+ "msgtype" : "text" ,
489+ "text" : {"content" : "Status update: {status}" , "contentlist" : ["{status}" ]},
490+ },
491+ }
492+ default_conf ["webhook" ] = webhook_config
493+
494+ webhook = Webhook (RPC (get_patched_freqtradebot (mocker , default_conf )), default_conf )
495+
496+ msg = {
497+ "type" : RPCMessageType .STATUS ,
498+ "status" : "running" ,
499+ }
500+
501+ post = mocker .patch ("freqtrade.rpc.webhook.post" )
502+ webhook .send_msg (msg )
503+
504+ expected_payload = {
505+ "msgtype" : "text" ,
506+ "text" : {"content" : "Status update: running" , "contentlist" : ["running" ]},
507+ }
508+
509+ post .assert_called_once_with ("https://example.com" , json = expected_payload , timeout = 10 )
You can’t perform that action at this time.
0 commit comments