#NEWLINE# @ patch ( 'os.access' , Mock ( return_value = True ) ) #NEWLINE# @ patch . object ( Collector , 'publish' ) #NEWLINE# def test_should_work_with_real_data_centos55_hdd( self , publish_mock ) : #NEWLINE# #INDENT# patch_listdir = patch ( 'os.listdir' , Mock ( return_value = [ 'sda' ] ) ) #NEWLINE# patch_communicate = patch ( 'subprocess.Popen.communicate' , Mock ( return_value = ( self . getFixture ( 'centos5.5_hdd' ) . getvalue ( ) , '' ) ) ) #NEWLINE# patch_listdir . start ( ) #NEWLINE# patch_communicate . start ( ) #NEWLINE# self . collector . collect ( ) #NEWLINE# patch_listdir . stop ( ) #NEWLINE# patch_communicate . stop ( ) #NEWLINE# metrics = { #NEWLINE# #INDENT# 'sda.Temperature_Celsius' : 28 , #NEWLINE# 'sda.Power_On_Hours' : 6827 , #NEWLINE# 'sda.Power_Cycle_Count' : 7 , #NEWLINE# 'sda.Power-Off_Retract_Count' : 5 , #NEWLINE# 'sda.UDMA_CRC_Error_Count' : 0 , #NEWLINE# 'sda.Load_Cycle_Count' : 2 , #NEWLINE# 'sda.Calibration_Retry_Count' : 0 , #NEWLINE# 'sda.Spin_Up_Time' : 3991 , #NEWLINE# 'sda.Spin_Retry_Count' : 0 , #NEWLINE# 'sda.Multi_Zone_Error_Rate' : 0 , #NEWLINE# 'sda.Raw_Read_Error_Rate' : 0 , #NEWLINE# 'sda.Reallocated_Event_Count' : 0 , #NEWLINE# 'sda.Start_Stop_Count' : 8 , #NEWLINE# 'sda.Offline_Uncorrectable' : 0 , #NEWLINE# 'sda.Current_Pending_Sector' : 0 , #NEWLINE# 'sda.Reallocated_Sector_Ct' : 0 , #NEWLINE# 'sda.Seek_Error_Rate' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# self . setDocExample ( collector = self . collector . __class__ . __name__ , metrics = metrics , defaultpath = patch_communicate . collector . config [ 'path' ] ) #NEWLINE# self . assertPublishedMany ( publish_mock , metrics )