<s> """<STR_LIT>""" <EOL> from logging import RootLogger <EOL> from mock import Mock <EOL> from st2reactor . container . sensor_wrapper import SensorService <EOL> from st2tests . mocks . datastore import MockDatastoreService <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> class MockSensorWrapper ( object ) : <EOL> def __init__ ( self , pack , class_name ) : <EOL> self . _pack = pack <EOL> self . _class_name = class_name <EOL> class MockSensorService ( SensorService ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , sensor_wrapper ) : <EOL> self . _sensor_wrapper = sensor_wrapper <EOL> self . _logger = Mock ( spec = RootLogger ) <EOL> self . dispatched_triggers = [ ] <EOL> self . _datastore_service = MockDatastoreService ( logger = self . _logger , <EOL> pack_name = self . _sensor_wrapper . _pack , <EOL> class_name = self . _sensor_wrapper . _class_name , <EOL> api_username = '<STR_LIT>' ) <EOL> def get_logger ( self , name ) : <EOL> """<STR_LIT>""" <EOL> return self . _logger <EOL> def dispatch_with_context ( self , trigger , payload = None , trace_context = None ) : <EOL> item = { <EOL> '<STR_LIT>' : trigger , <EOL> '<STR_LIT>' : payload , <EOL> '<STR_LIT>' : trace_context <EOL> } <EOL> self . dispatched_triggers . append ( item ) </s>
