<s> from test import CollectorTestCase , get_collector_config <EOL> from mock import MagicMock , patch <EOL> from pgq import PgQCollector <EOL> class TestPgQCollector ( CollectorTestCase ) : <EOL> def setUp ( self ) : <EOL> config = get_collector_config ( '<STR_LIT>' , { } ) <EOL> self . collector = PgQCollector ( config , None ) <EOL> def test_import ( self ) : <EOL> self . assertTrue ( PgQCollector ) <EOL> @ patch . object ( PgQCollector , '<STR_LIT>' ) <EOL> @ patch . object ( PgQCollector , '<STR_LIT>' ) <EOL> @ patch . object ( PgQCollector , '<STR_LIT>' ) <EOL> def test_collect ( self , get_queue_info , get_consumer_info , publish ) : <EOL> get_queue_info . return_value = iter ( [ <EOL> ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> } ) , <EOL> ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : <NUM_LIT:3> , <EOL> '<STR_LIT>' : <NUM_LIT:4> , <EOL> } ) , <EOL> ] ) <EOL> get_consumer_info . return_value = iter ( [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' , { <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : <NUM_LIT:3> , <EOL> } ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , { <EOL> '<STR_LIT>' : <NUM_LIT:4> , <EOL> '<STR_LIT>' : <NUM_LIT:5> , <EOL> '<STR_LIT>' : <NUM_LIT:6> , <EOL> } ) , <EOL> ] ) <EOL> self . collector . _collect_for_instance ( '<STR_LIT>' , connection = MagicMock ( ) ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:2> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:3> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:4> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:2> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:3> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:4> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:5> ) <EOL> self . assertPublished ( publish , '<STR_LIT>' , <NUM_LIT:6> ) </s>
