Exemple #1
0
class TestRunCommand(UnitTest):
    def setUp(self):
        self.setUpConfig()
        self.command = RunCommand(self.config)

    @mock.patch('clickable.container.Container.run_command',
                side_effect=empty_fn)
    @mock.patch('clickable.container.Container.setup', side_effect=empty_fn)
    def test_run(self, mock_setup, mock_run_command):
        self.command.run('echo foo')

        mock_setup.assert_called_once_with()
        mock_run_command.assert_called_once_with('echo foo',
                                                 use_build_dir=False,
                                                 tty=True,
                                                 localhost=True,
                                                 root_user=True)

    @mock.patch('clickable.container.Container.run_command',
                side_effect=empty_fn)
    @mock.patch('clickable.container.Container.setup', side_effect=empty_fn)
    def test_run_default_command(self, mock_setup, mock_run_command):
        self.command.run()

        mock_setup.assert_called_once_with()
        mock_run_command.assert_called_once_with('bash',
                                                 use_build_dir=False,
                                                 tty=True,
                                                 localhost=True,
                                                 root_user=True)
Exemple #2
0
class TestRunCommand(TestCase):
    def setUp(self):
        self.config = ConfigMock()
        self.command = RunCommand(self.config)

    @mock.patch('clickable.container.Container.run_command', side_effect=empty_fn)
    @mock.patch('clickable.container.Container.setup_dependencies', side_effect=empty_fn)
    def test_run(self, mock_setup_dependencies, mock_run_command):
        self.command.run('echo foo')

        mock_setup_dependencies.assert_called_once_with()
        mock_run_command.assert_called_once_with('echo foo', use_dir=False)

    def test_run_no_command(self):
        with self.assertRaises(ValueError):
            self.command.run()
Exemple #3
0
class TestRunCommand(TestCase):
    def setUp(self):
        self.config = ConfigMock({})
        self.command = RunCommand(self.config)

    @mock.patch('clickable.container.Container.run_command',
                side_effect=empty_fn)
    @mock.patch('clickable.container.Container.setup_dependencies',
                side_effect=empty_fn)
    def test_run(self, mock_setup_dependencies, mock_run_command):
        self.command.run('echo foo')

        mock_setup_dependencies.assert_called_once()
        mock_run_command.assert_called_once_with('echo foo', use_dir=False)

    def test_run_no_command(self):
        with self.assertRaises(ValueError):
            self.command.run()
Exemple #4
0
 def setUp(self):
     self.config = ConfigMock()
     self.command = RunCommand(self.config)
Exemple #5
0
 def setUp(self):
     self.setUpConfig()
     self.command = RunCommand(self.config)
Exemple #6
0
 def setUp(self):
     self.config = ConfigMock()
     self.config.container = Container(self.config)
     self.command = RunCommand(self.config)
Exemple #7
0
 def setUp(self):
     self.config = ConfigMock({})
     self.command = RunCommand(self.config)