File: test_snapshot.py

package info (click to toggle)
libvirt-dbus 1.4.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 888 kB
  • sloc: ansic: 8,558; xml: 1,588; python: 926; sh: 149; makefile: 19
file content (45 lines) | stat: -rwxr-xr-x 1,373 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3

import dbus
import libvirttest
import pytest

EXCEPTION_NO_PARENT = 'does not have a parent'


@pytest.mark.usefixtures("snapshot_create")
class TestSnapshot(libvirttest.BaseTestClass):
    """ Tests for methods and properties of the Snapshot snapshot
    """

    def test_snapshot_delete(self, snapshot_create):
        snapshot_obj = snapshot_create
        snapshot_obj.Delete(0)

    def test_snapshot_get_parent(self, snapshot_create):
        snapshot_obj = snapshot_create
        try:
            snapshot_obj.GetParent(0)
        except dbus.exceptions.DBusException as e:
            if not any(EXCEPTION_NO_PARENT in arg for arg in e.args):
                raise e

    def test_snapshot_get_xml(self, snapshot_create):
        snapshot_obj = snapshot_create
        assert isinstance(snapshot_obj.GetXMLDesc(0), dbus.String)

    def test_snapshot_get_is_current(self, snapshot_create):
        snapshot_obj = snapshot_create
        assert isinstance(snapshot_obj.IsCurrent(0), dbus.Boolean)

    def test_snapshot_list_children(self, snapshot_create):
        snapshot_obj = snapshot_create
        assert isinstance(snapshot_obj.ListChildren(0), dbus.Array)

    def test_snapshot_revert(self, snapshot_create):
        snapshot_obj = snapshot_create
        snapshot_obj.Revert(0)


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