Ejemplo n.º 1
0
 def test_get_device_id_exception(self):
     mocked_open = mock.mock_open()
     mocked_open.side_effect = IOError
     with mock.patch('os_net_config.utils.open', mocked_open, create=True):
         device = utils.get_device_id('nic2')
         self.assertEqual(None, device)
Ejemplo n.º 2
0
 def test_get_device_id_exception(self):
     mocked_open = mock.mock_open()
     mocked_open.side_effect = IOError
     with mock.patch('os_net_config.utils.open', mocked_open, create=True):
         device = utils.get_device_id('nic2')
         self.assertEqual(None, device)
Ejemplo n.º 3
0
 def test_get_device_id_success(self):
     mocked_open = mock.mock_open(read_data='0x1003\n')
     with mock.patch('os_net_config.utils.open', mocked_open, create=True):
         device = utils.get_device_id('nic2')
         self.assertEqual('0x1003', device)
Ejemplo n.º 4
0
 def test_get_device_id_success(self):
     mocked_open = mock.mock_open(read_data='0x1003\n')
     with mock.patch('os_net_config.utils.open', mocked_open, create=True):
         device = utils.get_device_id('nic2')
         self.assertEqual('0x1003', device)