summaryrefslogtreecommitdiff
path: root/virtManager/details
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2022-01-17 16:07:25 -0500
committerCole Robinson <crobinso@redhat.com>2022-01-17 17:11:18 -0500
commitacaca061be183957c4e2f99397f17711060401eb (patch)
treebf06d19682f100f9d319a3ef3f9009425ccaa1ec /virtManager/details
parent4f02ccd7b5e61fea693ce6e6e2ffd1b1c2f23654 (diff)
downloadvirt-manager-acaca061be183957c4e2f99397f17711060401eb.tar.gz
uitests: top off test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtManager/details')
-rw-r--r--virtManager/details/details.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/virtManager/details/details.py b/virtManager/details/details.py
index 27f2ecb7..aedd2ca7 100644
--- a/virtManager/details/details.py
+++ b/virtManager/details/details.py
@@ -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"