Example #1
0
class TestDevicesCommand(TestCase):
    def setUp(self):
        self.config = ConfigMock()
        self.command = DevicesCommand(self.config)

    @mock.patch('clickable.device.Device.detect_attached', side_effect=no_devices)
    @mock.patch('clickable.commands.devices.print_warning', side_effect=empty_fn)
    def test_no_devices(self, mock_print_warning, mock_detect_attached):
        self.command.run()

        mock_detect_attached.assert_called_once_with()
        mock_print_warning.assert_called_once_with('No attached devices')

    @mock.patch('clickable.device.Device.detect_attached', side_effect=devices)
    @mock.patch('clickable.commands.devices.print_info', side_effect=empty_fn)
    def test_no_devices(self, mock_print_info, mock_detect_attached):
        self.command.run()

        mock_detect_attached.assert_called_once_with()
        mock_print_info.assert_called_once_with('foo - bar')
Example #2
0
class TestDevicesCommand(TestCase):
    def setUp(self):
        self.config = ConfigMock({})
        self.command = DevicesCommand(self.config)

    @mock.patch('clickable.device.Device.detect_attached', side_effect=no_devices)
    @mock.patch('clickable.commands.devices.print_warning', side_effect=empty_fn)
    def test_no_devices(self, mock_print_warning, mock_detect_attached):
        self.command.run()

        mock_detect_attached.assert_called_once()
        mock_print_warning.assert_called_once_with('No attached devices')

    @mock.patch('clickable.device.Device.detect_attached', side_effect=devices)
    @mock.patch('clickable.commands.devices.print_info', side_effect=empty_fn)
    def test_no_devices(self, mock_print_info, mock_detect_attached):
        self.command.run()

        mock_detect_attached.assert_called_once()
        mock_print_info.assert_called_once_with('foo - bar')
Example #3
0
class TestDevicesCommand(UnitTest):
    def setUp(self):
        self.setUpConfig()
        self.command = DevicesCommand(self.config)

    @mock.patch('clickable.device.Device.detect_attached', side_effect=no_devices)
    @mock.patch('clickable.commands.devices.logger.warning', side_effect=empty_fn)
    def test_no_devices(self, mock_logger_warning, mock_detect_attached):
        self.command.run()

        mock_detect_attached.assert_called_once_with()
        mock_logger_warning.assert_called_once_with('No attached devices')

    @mock.patch('clickable.device.Device.detect_attached', side_effect=devices)
    @mock.patch('clickable.commands.devices.logger.info', side_effect=empty_fn)
    def test_no_devices(self, mock_logger_info, mock_detect_attached):
        self.command.run()

        mock_detect_attached.assert_called_once_with()
        mock_logger_info.assert_called_once_with('foo - bar')
Example #4
0
 def setUp(self):
     self.config = ConfigMock()
     self.command = DevicesCommand(self.config)
Example #5
0
 def setUp(self):
     self.config = ConfigMock({})
     self.command = DevicesCommand(self.config)
Example #6
0
 def setUp(self):
     self.config = ConfigMock()
     self.config.container = Container(self.config)
     self.command = DevicesCommand(self.config)
Example #7
0
 def setUp(self):
     self.setUpConfig()
     self.command = DevicesCommand(self.config)