Signed-off-by: Anya Harter <aharter@xxxxxxxxxx> --- tests/Makefile.am | 1 + tests/libvirttest.py | 12 ++++++++++++ tests/test_interface.py | 16 ++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100755 tests/test_interface.py diff --git a/tests/Makefile.am b/tests/Makefile.am index 09c3e2e..cd1fbd7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -11,6 +11,7 @@ test_helpers = \ test_programs = \ test_connect.py \ test_domain.py \ + test_interface.py \ test_network.py \ test_nodedev.py \ test_storage.py \ diff --git a/tests/libvirttest.py b/tests/libvirttest.py index 3741abd..2a09182 100644 --- a/tests/libvirttest.py +++ b/tests/libvirttest.py @@ -71,6 +71,18 @@ class BaseTestClass(): if self.timeout: raise TimeoutError() + def interface_create(self): + """ Fixture to define dummy interface on the test driver + + This fixture should be used in the setup of every test manipulating + with interfaces. + """ + path = self.connect.InterfaceDefineXML(xmldata.minimal_interface_xml, 0) + obj = self.bus.get_object('org.libvirt', path) + interface_obj = dbus.Interface(obj, 'org.libvirt.Interface') + interface_obj.Create(0) + return path, interface_obj + @pytest.fixture def node_device_create(self): """ Fixture to create dummy node device on the test driver diff --git a/tests/test_interface.py b/tests/test_interface.py new file mode 100755 index 0000000..88be5dc --- /dev/null +++ b/tests/test_interface.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 + +import dbus +import libvirttest + +class TestInterface(libvirttest.BaseTestClass): + """ Tests for methods and properties of the Interface interface + """ + + def test_interface_create(self): + _,interface_obj = self.interface_create() + interface_obj.Destroy(0) + interface_obj.Create(0) + +if __name__ == '__main__': + libvirttest.run() -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list