Exemplo n.º 1
0
class ZFCPInterfaceTestCase(unittest.TestCase):
    """Test DBus interface of the zFCP module."""
    def setUp(self):
        """Set up the module."""
        self.zfcp_module = ZFCPModule()
        self.zfcp_interface = ZFCPInterface(self.zfcp_module)

    @patch("pyanaconda.modules.storage.dasd.dasd.arch.is_s390",
           return_value=True)
    def is_supported_test(self, is_supported):
        self.assertEqual(self.zfcp_interface.IsSupported(), True)

    @patch_dbus_publish_object
    def discover_with_task_test(self, publisher):
        """Test the discover task."""
        task_path = self.zfcp_interface.DiscoverWithTask(
            "0.0.fc00", "0x5105074308c212e9", "0x401040a000000000")

        obj = check_task_creation(self, task_path, publisher, ZFCPDiscoverTask)

        self.assertEqual(obj.implementation._device_number, "0.0.fc00")
        self.assertEqual(obj.implementation._wwpn, "0x5105074308c212e9")
        self.assertEqual(obj.implementation._lun, "0x401040a000000000")

    @patch('pyanaconda.modules.storage.zfcp.zfcp.zfcp')
    @patch("pyanaconda.modules.storage.zfcp.zfcp.arch.is_s390",
           return_value=True)
    def write_configuration_test(self, arch, zfcp):
        """Test WriteConfiguration."""
        self.zfcp_interface.WriteConfiguration()
        zfcp.write.assert_called_once_with(conf.target.system_root)
Exemplo n.º 2
0
class ZFCPInterfaceTestCase(unittest.TestCase):
    """Test DBus interface of the zFCP module."""

    def setUp(self):
        """Set up the module."""
        self.zfcp_module = ZFCPModule()
        self.zfcp_interface = ZFCPInterface(self.zfcp_module)

    @patch('pyanaconda.dbus.DBus.publish_object')
    def discover_with_task_test(self, publisher):
        """Test the discover task."""
        task_path = self.zfcp_interface.DiscoverWithTask(
            "0.0.fc00",
            "0x5105074308c212e9",
            "0x401040a000000000"
        )

        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, ZFCPDiscoverTask)
        self.assertEqual(obj.implementation._device_number, "0.0.fc00")
        self.assertEqual(obj.implementation._wwpn, "0x5105074308c212e9")
        self.assertEqual(obj.implementation._lun, "0x401040a000000000")

    @patch('pyanaconda.modules.storage.zfcp.zfcp.zfcp')
    def reload_module_test(self, zfcp):
        """Test ReloadModule."""
        self.zfcp_interface.ReloadModule()
        zfcp.startup.assert_called_once_with()

    @patch('pyanaconda.modules.storage.zfcp.zfcp.zfcp')
    def write_configuration_test(self, zfcp):
        """Test WriteConfiguration."""

        with tempfile.TemporaryDirectory() as root:
            self.zfcp_interface.WriteConfiguration(root)
            zfcp.write.assert_called_once_with(root)
Exemplo n.º 3
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(ZFCP.object_path, ZFCPInterface(self))
Exemplo n.º 4
0
 def setUp(self):
     """Set up the module."""
     self.zfcp_module = ZFCPModule()
     self.zfcp_interface = ZFCPInterface(self.zfcp_module)