class FCOEInterfaceTestCase(unittest.TestCase): """Test DBus interface of the FCoE module.""" def setUp(self): """Set up the module.""" self.fcoe_module = FCOEModule() self.fcoe_interface = FCOEInterface(self.fcoe_module) def get_nics_test(self): """Test the get nics method.""" self.assertEqual(self.fcoe_interface.GetNics(), list()) def get_dracut_arguments(self): """Test the get dracut arguments method.""" self.assertEqual(self.fcoe_interface.GetDracutArguments("eth0"), list()) @patch('pyanaconda.dbus.DBus.publish_object') def discover_with_task_test(self, publisher): """Test the discover task.""" task_path = self.fcoe_interface.DiscoverWithTask( "eth0", # nic False, # dcb True # auto_vlan ) publisher.assert_called_once() object_path, obj = publisher.call_args[0] self.assertEqual(task_path, object_path) self.assertIsInstance(obj, TaskInterface) self.assertIsInstance(obj.implementation, FCOEDiscoverTask) self.assertEqual(obj.implementation._nic, "eth0") self.assertEqual(obj.implementation._dcb, False) self.assertEqual(obj.implementation._auto_vlan, True) @patch('pyanaconda.modules.storage.fcoe.fcoe.fcoe') def reload_module_test(self, fcoe): """Test ReloadModule.""" self.fcoe_interface.ReloadModule() fcoe.startup.assert_called_once_with() @patch('pyanaconda.modules.storage.fcoe.fcoe.fcoe') def write_configuration_test(self, fcoe): """Test WriteConfiguration.""" with tempfile.TemporaryDirectory() as root: self.fcoe_interface.WriteConfiguration(root) fcoe.write.assert_called_once_with(root)
class FCOEInterfaceTestCase(unittest.TestCase): """Test DBus interface of the FCoE module.""" def setUp(self): """Set up the module.""" self.fcoe_module = FCOEModule() self.fcoe_interface = FCOEInterface(self.fcoe_module) @patch("pyanaconda.modules.storage.fcoe.fcoe.has_fcoe", return_value=True) def is_supported_test(self, is_supported): self.assertEqual(self.fcoe_interface.IsSupported(), True) def get_nics_test(self): """Test the get nics method.""" self.assertEqual(self.fcoe_interface.GetNics(), list()) def get_dracut_arguments(self): """Test the get dracut arguments method.""" self.assertEqual(self.fcoe_interface.GetDracutArguments("eth0"), list()) @patch_dbus_publish_object def discover_with_task_test(self, publisher): """Test the discover task.""" task_path = self.fcoe_interface.DiscoverWithTask( "eth0", # nic False, # dcb True # auto_vlan ) obj = check_task_creation(self, task_path, publisher, FCOEDiscoverTask) self.assertEqual(obj.implementation._nic, "eth0") self.assertEqual(obj.implementation._dcb, False) self.assertEqual(obj.implementation._auto_vlan, True) @patch('pyanaconda.modules.storage.fcoe.fcoe.fcoe') def reload_module_test(self, fcoe): """Test ReloadModule.""" self.fcoe_interface.ReloadModule() fcoe.startup.assert_called_once_with() @patch('pyanaconda.modules.storage.fcoe.fcoe.fcoe') def write_configuration_test(self, fcoe): """Test WriteConfiguration.""" self.fcoe_interface.WriteConfiguration() fcoe.write.assert_called_once_with(conf.target.system_root)