예제 #1
0
 def test_physical_function(self, *args):
     with mock.patch.object(builtins, 'open',
                            mock.mock_open(read_data='4')):
         self.assertTrue(utils.is_physical_function(*self.pci_args))
예제 #2
0
 def test_exception(self, *args):
     self.assertFalse(utils.is_physical_function(*self.pci_args))
예제 #3
0
 def test_virtual_function(self, *args):
     with mock.patch.object(builtins, 'open', side_effect=IOError()):
         self.assertFalse(utils.is_physical_function(*self.pci_args))
예제 #4
0
 def _check_physical_function(self):
     if self.pci_address_spec.is_single_address():
         self.is_physical_function = (utils.is_physical_function(
             self.pci_address_spec.domain, self.pci_address_spec.bus,
             self.pci_address_spec.slot, self.pci_address_spec.func))
예제 #5
0
 def test_exception(self, *args):
     self.assertFalse(utils.is_physical_function(*self.pci_args))
예제 #6
0
 def test_physical_function(self, *args):
     with mock.patch.object(builtins, 'open',
                            mock.mock_open(read_data='4')):
         self.assertTrue(utils.is_physical_function(*self.pci_args))
예제 #7
0
 def test_virtual_function(self, *args):
     with mock.patch.object(builtins, 'open', side_effect=IOError()):
         self.assertFalse(utils.is_physical_function(*self.pci_args))