def test_createStompListener(self): connection = module.stomp.Connection() listener = module.StompListener(testCallback, ACKNOWLEDGEMENT, connection, MESSENGERID) self.assertEqual(listener.callback, testCallback) self.assertEqual(listener.ack, ACKNOWLEDGEMENT) self.assertEqual(listener.connection, connection) self.assertEqual(listener.mId, MESSENGERID)
def test_createStompListener(self): connection = module.stomp.Connection() messengerId = 'producer1' listener = module.StompListener(testCallback, ACKNOWLEDGEMENT, connection, messengerId) self.assertEqual(listener.callback, testCallback) self.assertEqual(listener.ack, ACKNOWLEDGEMENT) self.assertEqual(listener.connection, connection) self.assertEqual(listener.mId, messengerId)
def setUp(self): # external dependencies module.socket.gethostbyname_ex = MagicMock(return_value=GETHOSTBYNAME) module.time = MagicMock() module.ssl = MagicMock() connectionMock = MagicMock() connectionMock.is_connected.return_value = False module.stomp.Connection = MagicMock() module.stomp.Connection.return_value = connectionMock module.stomp.ConnectionListener = MagicMock() # prepare test object self.mqConnector = module.StompMQConnector() self.mqConnector.log = MagicMock()
def setUp(self): # external dependencies module.socket.gethostbyname_ex = MagicMock(return_value=GETHOSTBYNAME) module.time = MagicMock() module.ssl = MagicMock() module.json = MagicMock() connectionMock = MagicMock() connectionMock.is_connected.return_value = True module.stomp = MagicMock() module.stomp.Connection.return_value = connectionMock # internal dependencies module.MQConnector = MagicMock() module.gLogger = MagicMock() # prepare test object self.mqConnector = module.StompMQConnector()