2015-09-09 16:49:45 +03:00
import time
import unittest
import tests
2015-09-14 19:53:02 +03:00
from tests . uitests import utils as uiutils
2015-09-09 16:49:45 +03:00
class VMMCLI ( unittest . TestCase ) :
"""
UI tests for virt - manager ' s command line --show options
"""
def setUp ( self ) :
2015-09-14 19:53:02 +03:00
self . app = uiutils . DogtailApp ( tests . utils . uri_test )
2015-09-09 16:49:45 +03:00
def tearDown ( self ) :
self . app . kill ( )
##############
# Test cases #
##############
def testShowNewVM ( self ) :
self . app . open ( extra_opts = [ " --show-domain-creator " ] )
time . sleep ( .5 )
2015-09-14 19:53:02 +03:00
uiutils . find_pattern ( self . app . root , " New VM " , " frame " )
2015-09-09 16:49:45 +03:00
self . app . quit ( )
def testShowHost ( self ) :
self . app . open ( extra_opts = [ " --show-host-summary " ] )
time . sleep ( .5 )
2015-09-14 19:53:02 +03:00
win = uiutils . find_pattern ( self . app . root ,
2015-09-09 16:49:45 +03:00
" test testdriver.xml Connection Details " , " frame " )
2017-05-05 18:39:59 +03:00
self . assertEqual (
2015-09-14 19:53:02 +03:00
uiutils . find_fuzzy ( win , None , " text " , " Name: " ) . text ,
2015-09-09 16:49:45 +03:00
" test testdriver.xml " )
self . app . quit ( )
def testShowDetails ( self ) :
2017-03-06 23:35:02 +03:00
self . app . open ( extra_opts = [ " --show-domain-editor " , " test-clone-simple " ] )
2015-09-09 16:49:45 +03:00
time . sleep ( .5 )
2017-03-06 23:35:02 +03:00
win = uiutils . find_fuzzy ( self . app . root , " test-clone-simple on " , " frame " )
2015-09-09 16:49:45 +03:00
self . assertFalse (
2017-03-06 23:46:39 +03:00
uiutils . find_fuzzy ( win , " Guest is not running " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . assertTrue (
2015-09-14 19:53:02 +03:00
uiutils . find_fuzzy ( win , " add-hardware " , " button " ) . showing )
2015-09-09 16:49:45 +03:00
self . app . quit ( )
def testShowPerformance ( self ) :
self . app . open ( extra_opts = [ " --show-domain-performance " ,
2017-03-06 23:35:02 +03:00
" test-clone-simple " ] )
2015-09-09 16:49:45 +03:00
time . sleep ( .5 )
2017-03-06 23:35:02 +03:00
win = uiutils . find_fuzzy ( self . app . root , " test-clone-simple on " , " frame " )
2015-09-09 16:49:45 +03:00
self . assertFalse (
2017-03-06 23:46:39 +03:00
uiutils . find_fuzzy ( win , " Guest is not running " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . assertTrue (
2015-09-14 19:53:02 +03:00
uiutils . find_fuzzy ( win , " CPU usage " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . app . quit ( )
def testShowConsole ( self ) :
2017-03-06 23:35:02 +03:00
self . app . open ( extra_opts = [ " --show-domain-console " , " test-clone-simple " ] )
2015-09-09 16:49:45 +03:00
time . sleep ( .5 )
2017-03-06 23:35:02 +03:00
win = uiutils . find_fuzzy ( self . app . root , " test-clone-simple on " , " frame " )
2015-09-09 16:49:45 +03:00
self . assertTrue (
2017-03-06 23:46:39 +03:00
uiutils . find_fuzzy ( win , " Guest is not running " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . assertFalse (
2015-09-14 19:53:02 +03:00
uiutils . find_fuzzy ( win , " add-hardware " , " button " ) . showing )
2015-09-09 16:49:45 +03:00
self . app . quit ( )