1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +03:00
libvirt-python/tests/test_storage.py
Daniel P. Berrangé 1f44167510 tests: start basic unit tests for more APIs
To prevent regressions, especially with generated code, we need to have
test coverage of more APIs. This starts off with coverage for object
creation for all object types supported by the test driver
currently. This exercises constructors which have been broken several
times in the past.

Related https://gitlab.com/libvirt/libvirt-python/-/issues/4
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-06 12:25:14 +01:00

25 lines
600 B
Python

import unittest
import libvirt
class TestLibvirtStorage(unittest.TestCase):
def setUp(self):
self.conn = libvirt.open("test:///default")
self.pool = self.conn.storagePoolLookupByName("default-pool")
def tearDown(self):
self.pool = None
self.conn = None
def testAttr(self):
self.assertEqual(self.pool.name(), "default-pool")
def testVol(self):
volxml = '''<volume type="file">
<name>raw.img</name>
<allocation unit="M">10</allocation>
<capacity unit="M">1000</capacity>
</volume>'''
vol = self.pool.createXML(volxml)