<s> from __future__ import absolute_import <EOL> import py . test <EOL> import riemann_client . client <EOL> import riemann_client . riemann_pb2 <EOL> import riemann_client . transport <EOL> @ py . test . fixture <EOL> def queued_client ( request , string_transport ) : <EOL> """<STR_LIT>""" <EOL> client = riemann_client . client . QueuedClient ( transport = string_transport ) <EOL> client . transport . connect ( ) <EOL> @ request . addfinalizer <EOL> def disconnect ( ) : <EOL> client . transport . disconnect ( ) <EOL> return client <EOL> @ py . test . fixture <EOL> def using_simple_queue ( queued_client ) : <EOL> """<STR_LIT>""" <EOL> queued_client . event ( service = '<STR_LIT:test>' ) <EOL> @ py . test . fixture <EOL> def large_queue ( queued_client ) : <EOL> """<STR_LIT>""" <EOL> items = [ '<STR_LIT>' . format ( i ) for i in range ( <NUM_LIT:0> , <NUM_LIT:1000> ) ] <EOL> for description in items : <EOL> queued_client . event ( service = '<STR_LIT>' , description = description ) <EOL> return items <EOL> def test_simple_queue_event ( queued_client , using_simple_queue ) : <EOL> assert queued_client . queue . events [ <NUM_LIT:0> ] . service == '<STR_LIT:test>' <EOL> def test_simple_queue_length ( queued_client , using_simple_queue ) : <EOL> assert len ( queued_client . queue . events ) == <NUM_LIT:1> <EOL> def test_simple_queue_event_not_sent ( queued_client , using_simple_queue ) : <EOL> assert "<STR_LIT:test>" not in queued_client . transport . string . getvalue ( ) <EOL> def test_simple_queue_event_sent ( queued_client , using_simple_queue ) : <EOL> queued_client . flush ( ) <EOL> assert "<STR_LIT:test>" in queued_client . transport . string . getvalue ( ) <EOL> def test_deciqueue_length ( queued_client , large_queue ) : <EOL> assert len ( queued_client . queue . events ) == len ( large_queue ) <EOL> def test_deciqueue_output ( queued_client , large_queue ) : <EOL> queued_client . flush ( ) <EOL> for description in large_queue : <EOL> assert description in queued_client . transport . string . getvalue ( ) <EOL> def test_deciqueue_flush ( queued_client , large_queue ) : <EOL> queued_client . flush ( ) <EOL> assert len ( queued_client . queue . events ) == <NUM_LIT:0> <EOL> def test_clear_queue ( queued_client , using_simple_queue ) : <EOL> queued_client . clear_queue ( ) <EOL> assert len ( queued_client . queue . events ) == <NUM_LIT:0> </s>
