#NEWLINE# @ patch ( 'nailgun.statistics.oswl.collector.utils.get_proxy_for_cluster' ) #NEWLINE# @ patch ( 'nailgun.statistics.oswl.collector.utils.set_proxy' ) #NEWLINE# @ patch ( 'nailgun.statistics.oswl.collector.helpers.ClientProvider' ) #NEWLINE# @ patch ( 'nailgun.statistics.oswl.collector.helpers.get_info_from_os_resource_manager' ) #NEWLINE# def test_clear_data_for_removed_cluster( self , get_info_mock , * _ ) : #NEWLINE# #INDENT# ( cls_id , res_data ) = self . collect_for_operational_cluster ( get_info_mock ) #NEWLINE# cls = Cluster . get_by_uid ( cls ) #NEWLINE# Cluster . delete ( cls ) #NEWLINE# oswl_collect_once ( consts . OSWL_RESOURCE_TYPES . vm ) #NEWLINE# last = OpenStackWorkloadStats . get_last_by ( cls_id , consts . OSWL_RESOURCE_TYPES . vm ) #NEWLINE# removed = dict ( self . vms_info [ 0 ] ) #NEWLINE# removed [ 'time' ] = last . updated_time . isoformat ( ) #NEWLINE# res_data . update ( { #NEWLINE# #INDENT# 'removed' : [ removed ] , #NEWLINE# 'current' : [ ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( last . resource_data , res_data )