

@defer.inlineCallbacks
def test_long_content_delivery_UDH_SmppsConnector(self):
    (yield self.connect('127.0.0.1', self.pbPort))
    (yield self.prepareRoutingsAndStartConnector())
    (yield self.smppc_factory.connectAndBind())
    self.smppc_factory.lastProto.PDUDataRequestReceived = mock.Mock(wraps=self.smppc_factory.lastProto.PDUDataRequestReceived)
    baseUdh = []
    baseUdh.append(struct.pack('!B', 5))
    baseUdh.append(struct.pack('!B', 0))
    baseUdh.append(struct.pack('!B', 3))
    baseUdh.append(struct.pack('!B', int(id_generator(size=2, chars=string.digits))))
    baseUdh.append(struct.pack('!B', 3))
    basePdu = DeliverSM(source_addr='1234', destination_addr='4567', short_message='', esm_class=EsmClass(EsmClassMode.DEFAULT, EsmClassType.DEFAULT, [EsmClassGsmFeatures.UDHI_INDICATOR_SET]))
    pdu_part1 = copy.deepcopy(basePdu)
    udh_part1 = copy.deepcopy(baseUdh)
    pdu_part2 = copy.deepcopy(basePdu)
    udh_part2 = copy.deepcopy(baseUdh)
    pdu_part3 = copy.deepcopy(basePdu)
    udh_part3 = copy.deepcopy(baseUdh)
    udh_part1.append(struct.pack('!B', 1))
    pdu_part1.params['more_messages_to_send'] = MoreMessagesToSend.MORE_MESSAGES
    pdu_part1.params['short_message'] = (''.join(udh_part1) + '__1st_part_with_153_char________________________________________________________________________________________________________________________________.')
    udh_part2.append(struct.pack('!B', 2))
    pdu_part2.params['more_messages_to_send'] = MoreMessagesToSend.MORE_MESSAGES
    pdu_part2.params['short_message'] = (''.join(udh_part2) + '__2nd_part_with_153_char________________________________________________________________________________________________________________________________.')
    udh_part3.append(struct.pack('!B', 3))
    pdu_part3.params['more_messages_to_send'] = MoreMessagesToSend.NO_MORE_MESSAGES
    pdu_part3.params['short_message'] = (''.join(udh_part3) + '__3rd_part_end.')
    (yield self.triggerDeliverSmFromSMSC([pdu_part1, pdu_part2, pdu_part3]))
    self.assertEqual(self.smppc_factory.lastProto.PDUDataRequestReceived.call_count, 3)
    received_pdu_1 = self.smppc_factory.lastProto.PDUDataRequestReceived.call_args_list[0][0][0]
    self.assertEqual(received_pdu_1.seqNum, 1)
    self.assertEqual(received_pdu_1.id, pdu_types.CommandId.deliver_sm)
    self.assertEqual(received_pdu_1.params['source_addr'], basePdu.params['source_addr'])
    self.assertEqual(received_pdu_1.params['destination_addr'], basePdu.params['destination_addr'])
    self.assertEqual(received_pdu_1.params['esm_class'], basePdu.params['esm_class'])
    self.assertEqual(received_pdu_1.params['short_message'][6:], pdu_part1.params['short_message'][6:])
    received_pdu_2 = self.smppc_factory.lastProto.PDUDataRequestReceived.call_args_list[1][0][0]
    self.assertEqual(received_pdu_2.seqNum, 2)
    self.assertEqual(received_pdu_2.id, pdu_types.CommandId.deliver_sm)
    self.assertEqual(received_pdu_2.params['source_addr'], basePdu.params['source_addr'])
    self.assertEqual(received_pdu_2.params['destination_addr'], basePdu.params['destination_addr'])
    self.assertEqual(received_pdu_2.params['esm_class'], basePdu.params['esm_class'])
    self.assertEqual(received_pdu_2.params['short_message'][6:], pdu_part2.params['short_message'][6:])
    received_pdu_3 = self.smppc_factory.lastProto.PDUDataRequestReceived.call_args_list[2][0][0]
    self.assertEqual(received_pdu_3.seqNum, 3)
    self.assertEqual(received_pdu_3.id, pdu_types.CommandId.deliver_sm)
    self.assertEqual(received_pdu_3.params['source_addr'], basePdu.params['source_addr'])
    self.assertEqual(received_pdu_3.params['destination_addr'], basePdu.params['destination_addr'])
    self.assertEqual(received_pdu_3.params['esm_class'], basePdu.params['esm_class'])
    self.assertEqual(received_pdu_3.params['short_message'][6:], pdu_part3.params['short_message'][6:])
    (yield self.smppc_factory.smpp.unbindAndDisconnect())
    (yield self.stopSmppClientConnectors())

dataset/ETHPy150Open jookies/jasmin/jasmin/routing/test/test_routing_deliver_sm.py DeliverSmSmppThrowingTestCases.test_long_content_delivery_UDH_SmppsConnector/original