Пример #1
0
    def test_alert_linux(self, echo_mock, shell_mock):
        config = CliConfig()

        config.alert("hello")
        echo_mock.assert_called_once()
        shell_mock.assert_called_once()
        self.assertIn("notify-send", shell_mock.call_args[0][0])
Пример #2
0
    def test_alert__disabled(self, echo_mock, shell_mock):
        config = CliConfig()
        config.project_config.dev_config__no_alert = True

        config.alert("hello")
        echo_mock.assert_not_called()
        shell_mock.assert_not_called()
Пример #3
0
    def test_alert_osx(self, echo_mock, shell_mock):
        config = CliConfig()

        config.alert("hello")
        echo_mock.assert_called_once()
        shell_mock.assert_called_once()
        self.assertIn("osascript", shell_mock.call_args[0][0])
Пример #4
0
 def test_alert__os_error(self, echo_mock, shell_mock):
     shell_mock.side_effect = OSError
     config = CliConfig()
     config.alert("hello")
     echo_mock.assert_called_once()
     shell_mock.assert_called_once()