Ejemplo n.º 1
0
class BazInterfaceTestCase(unittest.TestCase):
    """Test DBus interface for the Baz module."""
    def setUp(self):
        """Set up the localization module."""
        self.module = Baz()
        self.interface = BazInterface(self.module)

    def kickstart_properties_test(self):
        """Test kickstart properties."""
        self.assertEqual(self.interface.KickstartCommands, [])
        self.assertEqual(self.interface.KickstartSections, [])
        self.assertEqual(self.interface.KickstartAddons, ["my_example_baz"])

    def _test_kickstart(self, ks_in, ks_out):
        check_kickstart_interface(self, self.interface, ks_in, ks_out)

    def no_kickstart_test(self):
        """Test with no kickstart."""
        ks_in = None
        ks_out = ""
        self._test_kickstart(ks_in, ks_out)

    def kickstart_test(self):
        """Test with kickstart."""
        ks_in = """
        %addon my_example_baz --foo=1 --bar
        The content of the baz section.
        %end
        """
        ks_out = """
        %addon my_example_baz --foo=1 --bar
        The content of the baz section.
        %end
        """
        self._test_kickstart(ks_in, ks_out)

    @patch_dbus_publish_object
    def configure_with_tasks_test(self, publisher):
        """Test ConfigureWithTasks."""
        task_classes = [BazConfigurationTask]
        task_paths = self.interface.ConfigureWithTasks()
        task_proxies = check_task_creation_list(self, task_paths, publisher,
                                                task_classes)
        self.assertEqual(len(task_proxies), 1)
        self.assertEqual(task_proxies[0].implementation.name, "Configure Baz")

    @patch_dbus_publish_object
    def install_with_tasks_test(self, publisher):
        """Test InstallWithTasks."""
        task_classes = [BazInstallationTask]
        task_paths = self.interface.InstallWithTasks()
        task_proxies = check_task_creation_list(self, task_paths, publisher,
                                                task_classes)
        self.assertEqual(len(task_proxies), 1)
        self.assertEqual(task_proxies[0].implementation.name, "Install Baz")
Ejemplo n.º 2
0
 def publish(self):
     """Publish the module."""
     TaskContainer.set_namespace(BAZ.namespace)
     DBus.publish_object(BAZ.object_path, BazInterface(self))
     DBus.register_service(BAZ.service_name)
Ejemplo n.º 3
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(BAZ.object_path, BazInterface(self))
     DBus.register_service(BAZ.service_name)
Ejemplo n.º 4
0
 def setUp(self):
     """Set up the localization module."""
     self.module = Baz()
     self.interface = BazInterface(self.module)
Ejemplo n.º 5
0
 def publish(self):
     """Publish the module."""
     DBus.publish_object(BazInterface(self), ADDON_BAZ_PATH)
     DBus.register_service(ADDON_BAZ_NAME)