| 289 | |
| 290 | @pytest.mark.skip_on_windows(reason="Module not available on Windows") |
| 291 | def test_modules(_modules, version_output, orig_env, bin_dir, mocked_env): |
| 292 | cmd_ret = {"retcode": 0, "stdout": version_output} |
| 293 | expected_output = {"retcode": 0, "stdout": _modules} |
| 294 | cmd_args = ["syslog-ng", "-V"] |
| 295 | |
| 296 | cmd_mock = MagicMock(return_value=cmd_ret) |
| 297 | with patch.dict(syslog_ng.__salt__, {"cmd.run_all": cmd_mock}), patch.dict( |
| 298 | os.environ, orig_env |
| 299 | ): |
| 300 | result = syslog_ng.modules() |
| 301 | assert result == expected_output |
| 302 | cmd_mock.assert_called_once_with(cmd_args, env=None, python_shell=False) |
| 303 | |
| 304 | cmd_mock = MagicMock(return_value=cmd_ret) |
| 305 | with patch.dict(syslog_ng.__salt__, {"cmd.run_all": cmd_mock}), patch.dict( |
| 306 | os.environ, orig_env |
| 307 | ): |
| 308 | result = syslog_ng.modules(syslog_ng_sbin_dir=bin_dir) |
| 309 | assert result == expected_output |
| 310 | cmd_mock.assert_called_once_with(cmd_args, env=mocked_env, python_shell=False) |
| 311 | |
| 312 | |
| 313 | @pytest.mark.skip_on_windows(reason="Module not available on Windows") |