Ejemplo n.º 1
0
    def _compare(self, cls, expected_xml):
        """Compare cls specification with the given xml."""
        generated_xml = get_xml(cls)  # pylint: disable=no-member

        self.assertEqual(
            XMLGenerator.prettify_xml(generated_xml),
            XMLGenerator.prettify_xml(expected_xml)
        )
Ejemplo n.º 2
0
    def _find_properties_specs(self, obj):
        """Find specifications of DBus properties.

        :param obj: an object with DBus properties
        :return: a map of property names and their specifications
        """
        specification = DBusSpecification.from_xml(get_xml(obj))
        properties_specs = {}

        for member in specification.members:
            if not isinstance(member, DBusSpecification.Property):
                continue

            if member.name in properties_specs:
                raise DBusSpecificationError(
                    "DBus property '{}' is defined in more than "
                    "one interface.".format(member.name))

            properties_specs[member.name] = member

        return properties_specs
Ejemplo n.º 3
0
    def _get_xml_specification(self):
        """Get the XML specification.

        :return: a XML specification
        """
        return get_xml(self._object)