<s> from test import CollectorTestCase <EOL> from test import get_collector_config <EOL> from mock import Mock <EOL> from mock import patch <EOL> from diamond . collector import Collector <EOL> from disktemp import DiskTemperatureCollector <EOL> class TestDiskTemperatureCollector ( CollectorTestCase ) : <EOL> def setUp ( self ) : <EOL> config = get_collector_config ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : '<STR_LIT:true>' , <EOL> } ) <EOL> self . collector = DiskTemperatureCollector ( config , None ) <EOL> def test_import ( self ) : <EOL> self . assertTrue ( DiskTemperatureCollector ) <EOL> @ patch . object ( Collector , '<STR_LIT>' ) <EOL> def test_smart_available ( self , publish_mock ) : <EOL> patch_listdir = patch ( '<STR_LIT>' , Mock ( return_value = [ '<STR_LIT>' ] ) ) <EOL> patch_communicate = patch ( <EOL> '<STR_LIT>' , <EOL> Mock ( return_value = ( <EOL> self . getFixture ( '<STR_LIT>' ) . getvalue ( ) , <EOL> '<STR_LIT>' ) ) ) <EOL> patch_listdir . start ( ) <EOL> patch_communicate . start ( ) <EOL> self . collector . collect ( ) <EOL> patch_listdir . stop ( ) <EOL> patch_communicate . stop ( ) <EOL> self . assertPublished ( publish_mock , '<STR_LIT>' , <NUM_LIT:50> ) <EOL> @ patch . object ( Collector , '<STR_LIT>' ) <EOL> def test_smart_unavailable ( self , publish_mock ) : <EOL> patch_listdir = patch ( '<STR_LIT>' , Mock ( return_value = [ '<STR_LIT>' ] ) ) <EOL> patch_communicate = patch ( <EOL> '<STR_LIT>' , <EOL> Mock ( return_value = ( <EOL> self . getFixture ( '<STR_LIT>' ) . getvalue ( ) , <EOL> '<STR_LIT>' ) ) ) <EOL> patch_listdir . start ( ) <EOL> patch_communicate . start ( ) <EOL> self . collector . collect ( ) <EOL> patch_listdir . stop ( ) <EOL> patch_communicate . stop ( ) <EOL> self . assertUnpublished ( publish_mock , '<STR_LIT>' , <NUM_LIT:50> ) <EOL> @ patch . object ( Collector , '<STR_LIT>' ) <EOL> def test_filter ( self , publish_mock ) : <EOL> self . collector . config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . collector . process_config ( ) <EOL> patch_listdir = patch ( '<STR_LIT>' , Mock ( return_value = [ '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> patch_communicate = patch ( <EOL> '<STR_LIT>' , <EOL> Mock ( return_value = ( <EOL> self . getFixture ( '<STR_LIT>' ) . getvalue ( ) , <EOL> '<STR_LIT>' ) ) ) <EOL> patch_listdir . start ( ) <EOL> patch_communicate . start ( ) <EOL> self . collector . collect ( ) <EOL> patch_listdir . stop ( ) <EOL> patch_communicate . stop ( ) <EOL> self . assertPublished ( publish_mock , '<STR_LIT>' , <NUM_LIT:50> ) <EOL> self . assertUnpublished ( publish_mock , '<STR_LIT>' , <NUM_LIT:50> ) <EOL> @ patch . object ( Collector , '<STR_LIT>' ) <EOL> def test_regex ( self , publish_mock ) : <EOL> self . collector . config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . collector . process_config ( ) <EOL> patch_listdir = patch ( '<STR_LIT>' , Mock ( return_value = [ '<STR_LIT>' ] ) ) <EOL> patch_communicate = patch ( <EOL> '<STR_LIT>' , <EOL> Mock ( return_value = ( <EOL> self . getFixture ( '<STR_LIT>' ) . getvalue ( ) , <EOL> '<STR_LIT>' ) ) ) <EOL> patch_listdir . start ( ) <EOL> patch_communicate . start ( ) <EOL> self . collector . collect ( ) <EOL> patch_listdir . stop ( ) <EOL> patch_communicate . stop ( ) <EOL> self . assertPublished ( publish_mock , '<STR_LIT>' , <NUM_LIT:50> ) </s>
