test_interface.py 1.3 KB
Newer Older
1
#!/usr/bin/env python3
2 3 4 5 6 7 8 9

import dbus
import libvirttest

class TestInterface(libvirttest.BaseTestClass):
    """ Tests for methods and properties of the Interface interface
    """

10 11 12 13 14
    def test_interface_undefine(self):
        _,interface_obj = self.interface_create()
        interface_obj.Destroy(0)
        interface_obj.Undefine()

15 16 17 18
    def test_interface_destroy(self):
        _,interface_obj = self.interface_create()
        interface_obj.Destroy(0)

19 20 21 22 23
    def test_interface_create(self):
        _,interface_obj = self.interface_create()
        interface_obj.Destroy(0)
        interface_obj.Create(0)

24 25 26 27
    def test_interface_get_xml_description(self):
        _,interface_obj = self.interface_create()
        assert isinstance(interface_obj.GetXMLDesc(0), dbus.String)

28 29 30 31 32 33 34
    def test_interface_properties_type(self):
        """ Ensure correct return type for Interface properties
        """
        test_interface_path,_ = self.interface_create()
        obj = self.bus.get_object('org.libvirt', test_interface_path)
        props = obj.GetAll('org.libvirt.Interface', dbus_interface=dbus.PROPERTIES_IFACE)
        assert isinstance(props['Name'], dbus.String)
35
        assert isinstance(props['MAC'], dbus.String)
36
        assert isinstance(props['Active'], dbus.Boolean)
37

38 39
if __name__ == '__main__':
    libvirttest.run()