def test_connection_made(self): client = GatewayClient() client.factory = Mock(hostname='opera.com', port=80) client.connectionMade() client.factory.connectionMade.assert_called_once_with(client)
def test_connection_made(self): client = GatewayClient() client.factory = Mock(hostname='opera.com', port=80) client.connectionMade() client.factory.connectionMade.assert_called_once_with(client)
def test_send(self): client = GatewayClient() client.transport = Mock() notification = Mock() client.send(notification) client.transport.write.assert_called_once_with( notification.to_binary_string())
def test_send(self): client = GatewayClient() client.transport = Mock() notification = Mock() client.send(notification) client.transport.write.assert_called_once_with( notification.to_binary_string())
def test_data_received(self, from_binary_string_mock): client = GatewayClient() client.factory = Mock() data = Mock() client.dataReceived(data) from_binary_string_mock.assert_called_once_with(data) client.factory.errorReceived.assert_called_once() self.assertIsInstance(client.factory.errorReceived.call_args[0][0], ErrorResponse)
def test_data_received(self, from_binary_string_mock): client = GatewayClient() client.factory = Mock() data = Mock() client.dataReceived(data) from_binary_string_mock.assert_called_once_with(data) client.factory.errorReceived.assert_called_once() self.assertIsInstance(client.factory.errorReceived.call_args[0][0], ErrorResponse)