@@ -33,9 +33,10 @@ def test_mqttwarn_main_help(capsys):
3333 assert "Usage:" in capsys .readouterr ().out
3434
3535
36- def test_run_mqttwarn (mocker , caplog ):
36+ def test_run_mqttwarn_with_configuration_from_environment (mocker , caplog ):
3737 """
3838 Verify that `mqttwarn.commands.run_mqttwarn` works as expected.
39+ Here, a configuration file is obtained using the `MQTTWARNINI` environment variable.
3940 """
4041 mocker .patch ("os.environ" , {"MQTTWARNINI" : "tests/etc/no-functions.ini" })
4142 mocker .patch ("sys.argv" , ["mqttwarn" ])
@@ -48,7 +49,22 @@ def test_run_mqttwarn(mocker, caplog):
4849 ]
4950
5051
51- def test_run (mocker , caplog ):
52+ def test_run_mqttwarn_with_configuration_from_file (mocker , caplog ):
53+ """
54+ Verify that `mqttwarn.commands.run_mqttwarn` works as expected.
55+ Here, a configuration file is obtained using the `--config-file` command line option.
56+ """
57+ mocker .patch ("sys.argv" , ["mqttwarn-custom" ])
58+ mocker .patch ("mqttwarn.commands.subscribe_forever" )
59+ mqttwarn .commands .run_mqttwarn (configfile = "tests/etc/no-functions.ini" )
60+
61+ assert caplog .messages == [
62+ "Starting mqttwarn-custom" ,
63+ "Log level is DEBUG" ,
64+ ]
65+
66+
67+ def test_run_command (mocker , caplog ):
5268 """
5369 Verify that `mqttwarn.commands.run` works as expected.
5470 """
0 commit comments