uitests: top off test coverage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2022-01-17 16:07:25 -05:00
parent 4f02ccd7b5
commit acaca061be
6 changed files with 22 additions and 21 deletions

View File

@ -3,8 +3,6 @@
import unittest.mock
import pytest
import tests
from . import lib

View File

@ -89,7 +89,8 @@ def _testRename(app, win, origname, newname):
app.root.find_fuzzy(newname, "table cell")
# Make sure the old entry is gone
lib.utils.check(lambda: origname not in oldcell.name)
if origname != newname:
lib.utils.check(lambda: origname not in oldcell.name)
def testDetailsRenameSimple(app):
@ -98,6 +99,7 @@ def testDetailsRenameSimple(app):
"""
origname = "test-clone-simple"
win = app.manager_open_details(origname)
_testRename(app, win, origname, origname)
_testRename(app, win, origname, "test-new-name")

View File

@ -318,26 +318,18 @@ def _get_performance_icon_name():
def _unindent_device_xml(xml):
"""
The device parsed from a domain will have no indent
for the first line, but then <domain> expected indent
from the remaining lines. Try to unindent the remaining
lines so it looks nice in the XML editor.
"""
lines = xml.splitlines()
if not xml.startswith("<") or len(lines) < 2:
return xml
if not lines:
return xml # pragma: no cover
ret = ""
unindent = 0
for c in lines[1]:
for c in lines[0]:
if c != " ":
break
unindent += 1
unindent = max(0, unindent - 2)
ret = lines[0] + "\n"
for line in lines[1:]:
for line in lines:
if re.match(r"^%s *<.*$" % (unindent * " "), line):
line = line[unindent:]
ret += line + "\n"

View File

@ -128,7 +128,6 @@ class vmmStatsManager(vmmGObject):
self._disk_stats_lxc_supported = True
self._mem_stats_supported = True
def _cleanup(self):
for statslist in self._vm_stats.values():
statslist.cleanup()
@ -390,7 +389,9 @@ class vmmStatsManager(vmmGObject):
####################
def _get_all_stats(self, conn):
if not self._all_stats_supported:
# test conn supports allstats as of 2021, but for test coverage
# purposes lets still use the old stats code for the test driver
if not self._all_stats_supported or conn.is_test():
return {}
statflags = 0

View File

@ -107,9 +107,19 @@ def fake_openauth(conn, cb, data):
class fakeVirtBootstrap:
@staticmethod
def bootstrap(**kwargs):
import time
time.sleep(1)
import logging
log = logging.getLogger("virtBootstrap")
log.info("mock virtBootstrap msg1")
kwargs["progress_cb"]({"status": "msg1"})
time.sleep(.5)
log.info("mock virtBootstrap msg2")
kwargs["progress_cb"]({"status": "msg2"})
time.sleep(.5)
log.info("mock virtBootstrap msg3")
kwargs["progress_cb"]({"status": "msg3"})
if "username" in kwargs:
raise RuntimeError("fakeVirtBootstrap mock auth failure!")

View File

@ -53,14 +53,12 @@ class vmmNodeDevice(vmmLibvirtObject):
def _XMLDesc(self, flags):
return self._backend.XMLDesc(flags)
def _get_backend_status(self):
return self._STATUS_ACTIVE
def _using_events(self):
return self.conn.using_node_device_events
def _get_backend_status(self):
is_active = True
if self.conn.support.nodedev_isactive(self._backend):
is_active = self._backend.isActive()
is_active = self._backend.isActive() # pragma: no cover
return (is_active and
self._STATUS_ACTIVE or
self._STATUS_INACTIVE)