mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
uitests: Add connection login console lookup testing
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
485dddf2ed
commit
55fd4ccd23
@ -105,3 +105,8 @@ class UITestConnection(uiutils.UITestCase):
|
||||
uiutils.check(lambda: not dialog.showing)
|
||||
self._click_alert_button("Unable to connect", "Close")
|
||||
manager.find("test testdriver.xml - Not Connected", "table cell")
|
||||
|
||||
def testConnectionSessionError(self):
|
||||
self.app.open(
|
||||
extra_opts=["--test-options=fake-session-error"])
|
||||
self._click_alert_button("Could not detect a local session", "Close")
|
||||
|
@ -915,6 +915,11 @@ class vmmConnection(vmmGObject):
|
||||
data = self
|
||||
if self.config.CLITestOptions.fake_openauth:
|
||||
testmock.fake_openauth(self, cb, data)
|
||||
if self.config.CLITestOptions.fake_session_error:
|
||||
lerr = libvirt.libvirtError("fake session error")
|
||||
lerr.err = [libvirt.VIR_ERR_AUTH_FAILED, None,
|
||||
"fake session error not authorized"]
|
||||
raise lerr
|
||||
self._backend.open(cb, data)
|
||||
return True, None
|
||||
except Exception as e:
|
||||
@ -935,8 +940,9 @@ class vmmConnection(vmmGObject):
|
||||
log.debug("Looks like we might have failed policykit "
|
||||
"auth. Checking to see if we have a valid "
|
||||
"console session")
|
||||
if (not self.is_remote() and
|
||||
not connectauth.do_we_have_session()):
|
||||
if not self.is_remote():
|
||||
warnconsole = bool(not connectauth.do_we_have_session())
|
||||
if self.config.CLITestOptions.fake_session_error:
|
||||
warnconsole = True
|
||||
|
||||
ConnectError = connectauth.connect_error(
|
||||
|
@ -165,6 +165,8 @@ class CLITestOptionsClass:
|
||||
* fake-nodedev-event: Fake nodedev API events
|
||||
* fake-openauth: Fake user+pass response from libvirt openauth,
|
||||
for testing the TCP URI auth dialog
|
||||
* fake-session-error: Fake a connection open error that
|
||||
triggers logind session lookup
|
||||
"""
|
||||
def __init__(self, test_options_str):
|
||||
optset = set()
|
||||
@ -208,6 +210,7 @@ class CLITestOptionsClass:
|
||||
self.fake_agent_event = _get_value("fake-agent-event")
|
||||
self.fake_nodedev_event = _get_value("fake-nodedev-event")
|
||||
self.fake_openauth = _get("fake-openauth")
|
||||
self.fake_session_error = _get("fake-session-error")
|
||||
|
||||
if optset: # pragma: no cover
|
||||
raise RuntimeError("Unknown --test-options keys: %s" % optset)
|
||||
|
Loading…
Reference in New Issue
Block a user