mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-06 13:17:58 +03:00
tests: uitests: Use keyfile to test initial conn loading
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
8dd3b8ba20
commit
c6830740f3
11
tests/uitests/data/keyfile/defaultconn.ini
Normal file
11
tests/uitests/data/keyfile/defaultconn.ini
Normal file
@ -0,0 +1,11 @@
|
||||
[org/virt-manager/virt-manager/vmlist-fields]
|
||||
disk-usage=false
|
||||
network-traffic=false
|
||||
|
||||
[org/virt-manager/virt-manager/connections]
|
||||
uris=['test:///default', 'foo:///']
|
||||
autoconnect=['test:///default']
|
||||
|
||||
[org/virt-manager/virt-manager]
|
||||
manager-window-width=550
|
||||
manager-window-height=550
|
@ -89,3 +89,16 @@ class VMMPrefs(uiutils.UITestCase):
|
||||
detailswin.find("Details", "page tab").click()
|
||||
uiutils.check_in_loop(lambda:
|
||||
detailswin.find("Title:", "text").text == "FOOTITLE")
|
||||
|
||||
def testPrefsKeyfile(self):
|
||||
"""
|
||||
Preload some keyfile settings and verify they work as expected
|
||||
"""
|
||||
import os
|
||||
keyfile = os.path.dirname(__file__) + "/data/keyfile/defaultconn.ini"
|
||||
self.app.open(use_uri=False, keyfile=keyfile)
|
||||
managerwin = self.app.topwin
|
||||
|
||||
# test:///default should be connected
|
||||
managerwin.find("test default", "table cell")
|
||||
managerwin.find("foo - Not Connected", "table cell")
|
||||
|
@ -455,7 +455,7 @@ class VMMDogtailApp(object):
|
||||
return bool(self._proc and self._proc.poll() is None)
|
||||
|
||||
def open(self, extra_opts=None, check_already_running=True, use_uri=True,
|
||||
window_name=None, xmleditor_enabled=False):
|
||||
window_name=None, xmleditor_enabled=False, keyfile=None):
|
||||
extra_opts = extra_opts or []
|
||||
|
||||
if tests.utils.TESTCONFIG.debug:
|
||||
@ -472,8 +472,20 @@ class VMMDogtailApp(object):
|
||||
"--no-fork"]
|
||||
if use_uri:
|
||||
cmd += ["--connect", self.uri]
|
||||
|
||||
testoptions = []
|
||||
if xmleditor_enabled:
|
||||
cmd += ["--test-options=xmleditor-enabled"]
|
||||
testoptions.append("xmleditor-enabled")
|
||||
if keyfile:
|
||||
import atexit
|
||||
import tempfile
|
||||
tempname = tempfile.mktemp(prefix="virtmanager-uitests-keyfile")
|
||||
open(tempname, "w").write(open(keyfile).read())
|
||||
atexit.register(lambda: os.unlink(tempname))
|
||||
testoptions.append("gsettings-keyfile=%s" % tempname)
|
||||
|
||||
if testoptions:
|
||||
cmd += ["--test-options=%s" % ",".join(testoptions)]
|
||||
cmd += extra_opts
|
||||
|
||||
if check_already_running:
|
||||
|
Loading…
Reference in New Issue
Block a user