Exemplo n.º 1
0
    def test_start_command_bad_basedir(self):
        """
        test calling startCommand() with invalid basedir path
        """

        # patch isBuildslaveDir() to fail
        self.setupUpIsBuildslaveDir(False)

        # call startCommand() and check that correct exit code is returned
        config = {"basedir": "dummy"}
        self.assertEqual(start.startCommand(config), 1, "unexpected exit code")

        # check that isBuildslaveDir was called with correct argument
        self.isBuildslaveDir.assert_called_once_with("dummy")
Exemplo n.º 2
0
    def test_start_command_bad_basedir(self):
        """
        test calling startCommand() with invalid basedir path
        """

        # patch isBuildslaveDir() to fail
        self.setupUpIsBuildslaveDir(False)

        # call startCommand() and check that correct exit code is returned
        config = {"basedir": "dummy"}
        self.assertEqual(start.startCommand(config), 1, "unexpected exit code")

        # check that isBuildslaveDir was called with correct argument
        self.isBuildslaveDir.assert_called_once_with("dummy")
Exemplo n.º 3
0
    def test_start_command_good(self):
        """
        test successful startCommand() call
        """

        # patch basedir check to always succeed
        self.setupUpIsBuildslaveDir(True)

        # patch startSlave() to do nothing
        mocked_startSlave = mock.Mock(return_value=0)
        self.patch(start, "startSlave", mocked_startSlave)

        config = {"basedir": "dummy", "nodaemon": False, "quiet": False}
        self.assertEqual(start.startCommand(config), 0, "unexpected exit code")

        # check that isBuildslaveDir() and startSlave() were called
        # with correct argument
        self.isBuildslaveDir.assert_called_once_with("dummy")
        mocked_startSlave.assert_called_once_with(config["basedir"],
                                                  config["quiet"],
                                                  config["nodaemon"])
Exemplo n.º 4
0
    def test_start_command_good(self):
        """
        test successful startCommand() call
        """

        # patch basedir check to always succeed
        self.setupUpIsBuildslaveDir(True)

        # patch startSlave() to do nothing
        mocked_startSlave = mock.Mock(return_value=0)
        self.patch(start, "startSlave", mocked_startSlave)

        config = {"basedir": "dummy", "nodaemon": False, "quiet": False}
        self.assertEqual(start.startCommand(config), 0, "unexpected exit code")

        # check that isBuildslaveDir() and startSlave() were called
        # with correct argument
        self.isBuildslaveDir.assert_called_once_with("dummy")
        mocked_startSlave.assert_called_once_with(config["basedir"],
                                                  config["quiet"],
                                                  config["nodaemon"])