def test_restart(self):
        """
        test calling restart() when slave is running
        """
        # patch stopSlave() to do nothing
        mock_stopSlave = mock.Mock()
        self.patch(runner, "stopSlave", mock_stopSlave)

        # check that restart() calls start() and prints correct messages
        runner.restart(self.config)
        self.assertStdoutEqual("now restarting buildslave process..\n")
        self.start.assert_called_once_with(self.config)
Esempio n. 2
0
    def test_restart(self):
        """
        test calling restart() when slave is running
        """
        # patch stopSlave() to do nothing
        mock_stopSlave = mock.Mock()
        self.patch(runner, "stopSlave", mock_stopSlave)

        # check that restart() calls start() and prints correct messages
        runner.restart(self.config)
        self.assertStdoutEqual("now restarting buildslave process..\n")
        self.start.assert_called_once_with(self.config)
    def test_no_slave_running(self):
        """
        test calling restart() when no slave is running
        """
        # patch stopSlave() to raise an exception
        mock_stopSlave = mock.Mock(side_effect=runner.SlaveNotRunning())
        self.patch(runner, "stopSlave", mock_stopSlave)

        # check that restart() calls start() and prints correct messages
        runner.restart(self.config)
        self.start.assert_called_once_with(self.config)
        self.assertStdoutEqual("no old buildslave process found to stop\n"
                               "now restarting buildslave process..\n")
Esempio n. 4
0
    def test_no_slave_running(self):
        """
        test calling restart() when no slave is running
        """
        # patch stopSlave() to raise an exception
        mock_stopSlave = mock.Mock(side_effect=runner.SlaveNotRunning())
        self.patch(runner, "stopSlave", mock_stopSlave)

        # check that restart() calls start() and prints correct messages
        runner.restart(self.config)
        self.start.assert_called_once_with(self.config)
        self.assertStdoutEqual("no old buildslave process found to stop\n"
                               "now restarting buildslave process..\n")