class NVDIMMInterfaceTestCase(unittest.TestCase): """Test DBus interface of the NVDIMM module.""" def setUp(self): """Set up the module.""" self.nvdimm_module = NVDIMMModule() self.nvdimm_interface = NVDIMMInterface(self.nvdimm_module) def get_devices_to_ignore_test(self): """Test GetDevicesToIgnore.""" self.assertEqual(self.nvdimm_interface.GetDevicesToIgnore(), []) def set_namespaces_to_use_test(self): """Test SetNamespacesToUse.""" self.nvdimm_interface.SetNamespacesToUse( ["namespace0.0", "namespace1.0"]) @patch('pyanaconda.dbus.DBus.publish_object') def reconfigure_with_task_test(self, publisher): """Test ReconfigureWithTask.""" task_path = self.nvdimm_interface.ReconfigureWithTask( "namespace0.0", "sector", 512) 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, NVDIMMReconfigureTask) self.assertEqual(obj.implementation._namespace, "namespace0.0") self.assertEqual(obj.implementation._mode, "sector") self.assertEqual(obj.implementation._sector_size, 512) self.assertIsNone(self.nvdimm_module.find_action("namespace0.0")) obj.implementation.succeeded_signal.emit() action = self.nvdimm_module.find_action("namespace0.0") self.assertEqual(action.action, NVDIMM_ACTION_RECONFIGURE) self.assertEqual(action.namespace, "namespace0.0") self.assertEqual(action.mode, "sector") self.assertEqual(action.sectorsize, 512)
class NVDIMMInterfaceTestCase(unittest.TestCase): """Test DBus interface of the NVDIMM module.""" def setUp(self): """Set up the module.""" self.nvdimm_module = NVDIMMModule() self.nvdimm_interface = NVDIMMInterface(self.nvdimm_module) def get_devices_to_ignore_test(self): """Test GetDevicesToIgnore.""" self.assertEqual(self.nvdimm_interface.GetDevicesToIgnore(), []) def set_namespaces_to_use_test(self): """Test SetNamespacesToUse.""" self.nvdimm_interface.SetNamespacesToUse(["namespace0.0", "namespace1.0"]) @patch('pyanaconda.dbus.DBus.publish_object') def reconfigure_with_task_test(self, publisher): """Test ReconfigureWithTask.""" task_path = self.nvdimm_interface.ReconfigureWithTask("namespace0.0", "sector", 512) 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, NVDIMMReconfigureTask) self.assertEqual(obj.implementation._namespace, "namespace0.0") self.assertEqual(obj.implementation._mode, "sector") self.assertEqual(obj.implementation._sector_size, 512) self.assertIsNone(self.nvdimm_module.find_action("namespace0.0")) obj.implementation.succeeded_signal.emit() action = self.nvdimm_module.find_action("namespace0.0") self.assertEqual(action.action, NVDIMM_ACTION_RECONFIGURE) self.assertEqual(action.namespace, "namespace0.0") self.assertEqual(action.mode, "sector") self.assertEqual(action.sectorsize, 512)
class NVDIMMInterfaceTestCase(unittest.TestCase): """Test DBus interface of the NVDIMM module.""" def setUp(self): """Set up the module.""" self.nvdimm_module = NVDIMMModule() self.nvdimm_interface = NVDIMMInterface(self.nvdimm_module) def test_is_supported(self): self.assertEqual(self.nvdimm_interface.IsSupported(), True) def test_get_devices_to_ignore(self): """Test GetDevicesToIgnore.""" self.assertEqual(self.nvdimm_interface.GetDevicesToIgnore(), []) def test_set_namespaces_to_use(self): """Test SetNamespacesToUse.""" self.nvdimm_interface.SetNamespacesToUse( ["namespace0.0", "namespace1.0"]) @patch_dbus_publish_object def test_reconfigure_with_task(self, publisher): """Test ReconfigureWithTask.""" task_path = self.nvdimm_interface.ReconfigureWithTask( "namespace0.0", "sector", 512) obj = check_task_creation(self, task_path, publisher, NVDIMMReconfigureTask) self.assertEqual(obj.implementation._namespace, "namespace0.0") self.assertEqual(obj.implementation._mode, "sector") self.assertEqual(obj.implementation._sector_size, 512) self.assertIsNone(self.nvdimm_module.find_action("namespace0.0")) obj.implementation.succeeded_signal.emit() action = self.nvdimm_module.find_action("namespace0.0") self.assertEqual(action.action, NVDIMM_ACTION_RECONFIGURE) self.assertEqual(action.namespace, "namespace0.0") self.assertEqual(action.mode, "sector") self.assertEqual(action.sectorsize, 512)