#NEWLINE# @ mock . patch . object ( fakelibvirt . virDomain , 'jobInfo' ) #NEWLINE# @ mock . patch . object ( fakelibvirt . virDomain , 'jobStats' ) #NEWLINE# def test_job_info_operation_invalid( self , mock_stats , mock_info ) : #NEWLINE# #INDENT# mock_stats . side_effect = fakelibvirt . make_libvirtError ( fakelibvirt . libvirtError , 'virDomainGetJobStats not implemented' , fakelibvirt . VIR_ERR_NO_SUPPORT ) #NEWLINE# mock_info . side_effect = fakelibvirt . make_libvirtError ( fakelibvirt . libvirtError , 'Domain is not running' , fakelibvirt . VIR_ERR_OPERATION_INVALID ) #NEWLINE# info = host . DomainJobInfo . for_domain ( self . dom ) #NEWLINE# self . assertIsInstance ( info , host . DomainJobInfo ) #NEWLINE# self . assertEqual ( fakelibvirt . VIR_DOMAIN_JOB_COMPLETED , info . type ) #NEWLINE# self . assertEqual ( 0 , info . time_elapsed ) #NEWLINE# self . assertEqual ( 0 , info . time_remaining ) #NEWLINE# self . assertEqual ( 0 , self . memory_total ) #NEWLINE# self . assertEqual ( 0 , info . memory_processed ) #NEWLINE# self . assertEqual ( 0 , info . memory_remaining ) #NEWLINE# mock_stats . assert_called_once_with ( ) #NEWLINE# mock_info . assert_called_once_with ( )