Skip to content

Commit

Permalink
add new tests from jasmin
Browse files Browse the repository at this point in the history
  • Loading branch information
DomAmato committed Apr 15, 2020
1 parent dc06692 commit 7aabfd5
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions tests/test_pdu_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,85 @@ def test_SubmitSM_ringtone_conversion(self):
)
self.do_conversion_test(PDUEncoder(), pdu, '000000a900000004000000000006f3910005006d6f62696c65776179000101333336393830393334320040000000000100f5007506050415811581024a3a5db5a5cdcda5bdb8040084d8c51381481381481381481381481381381481581681781881881061881061b81081181081881061881061681081781081881061881061b81081181081881061881061681081781081b81881321081b81881221081b818811210824dc1446000')

def test_DeliverSM_with_network_error_code(self):
"""Related to #117"""

pdu = DeliverSM(1,
service_type='',
source_addr_ton=AddrTon.INTERNATIONAL,
source_addr_npi=AddrNpi.ISDN,
source_addr='4915256794887',
dest_addr_ton=AddrTon.INTERNATIONAL,
dest_addr_npi=AddrNpi.ISDN,
destination_addr='04051306999',
esm_class=EsmClass(EsmClassMode.DEFAULT, EsmClassType.DEFAULT),
protocol_id=0,
priority_flag=PriorityFlag.LEVEL_0,
registered_delivery=RegisteredDelivery(
RegisteredDeliveryReceipt.NO_SMSC_DELIVERY_RECEIPT_REQUESTED),
replace_if_present_flag=ReplaceIfPresentFlag.DO_NOT_REPLACE,
data_coding=DataCoding(DataCodingScheme.GSM_MESSAGE_CLASS,
DataCodingGsmMsg(DataCodingGsmMsgCoding.DEFAULT_ALPHABET,
DataCodingGsmMsgClass.CLASS_2)),
short_message='id:bc59b8aa-2fd2-4035-8113-19301e050079 sub:001 dlvrd:001 submit date:150508144058 done date:150508144058 stat:DELIVRD err:000 text:-',
sm_default_msg_id=0,
message_state=MessageState.DELIVERED,
receipted_message_id='bc59b8aa-2fd2-4035-8113-19301e050079',
network_error_code='\x03\x00\x00',
)
self.do_conversion_test(PDUEncoder(), pdu, '000000f30000000500000000000000010001013439313532353637393438383700010130343035313330363939390000000000000000f2008569643a62633539623861612d326664322d343033352d383131332d313933303165303530303739207375623a30303120646c7672643a303031207375626d697420646174653a31353035303831343430353820646f6e6520646174653a31353035303831343430353820737461743a44454c49565244206572723a30303020746578743a2d042300030300000427000102001e002562633539623861612d326664322d343033352d383131332d31393330316530353030373900')

def test_DeliverSM_with_vendor_specific_bypass(self):
"""#449: fixing the 'Value -1 is less than min 0' error caused by the vendor_specific_bypass parameter"""
pdu = DeliverSM(1141690945,
service_type='',
source_addr_ton=AddrTon.INTERNATIONAL,
source_addr_npi=AddrNpi.ISDN,
source_addr='27727331834',
dest_addr_ton=AddrTon.INTERNATIONAL,
dest_addr_npi=AddrNpi.ISDN,
destination_addr='27600701040',
esm_class=EsmClass(EsmClassMode.DEFAULT, EsmClassType.DEFAULT),
protocol_id=0,
priority_flag=PriorityFlag.LEVEL_0,
registered_delivery=RegisteredDelivery(
RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED),
replace_if_present_flag=ReplaceIfPresentFlag.DO_NOT_REPLACE,
data_coding=DataCoding(schemeData=DataCodingDefault.SMSC_DEFAULT_ALPHABET),
short_message='Replied tue 16 Aug 10h11',
sm_default_msg_id=0,
vendor_specific_bypass='2782913594\x00',
)
self.do_conversion_test(PDUEncoder(), pdu, '0000004f0000000500000000440cd2410001013237373237333331383334000101323736303037303130343000000000000001000000185265706c6965642074756520313620417567203130683131')

def test_SubmitSM_with_data_coding_mclass_1(self):
pdu = SubmitSM(2,
source_addr=b'385915222656',
destination_addr=b'385953926992',
short_message=b'jsmtest2 dc f1',
data_coding=DataCoding(
DataCodingScheme.GSM_MESSAGE_CLASS,
DataCodingGsmMsg(
DataCodingGsmMsgCoding.DEFAULT_ALPHABET,
DataCodingGsmMsgClass.CLASS_1
)
),
service_type='',
esm_class=EsmClass(EsmClassMode.DEFAULT, EsmClassType.DEFAULT, []),
protocol_id=0,
priority_flag=PriorityFlag.LEVEL_0,
registered_delivery=RegisteredDelivery(
RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED),
replace_if_present_flag=ReplaceIfPresentFlag.DO_NOT_REPLACE,
sm_default_msg_id=0,
source_addr_ton=AddrTon.INTERNATIONAL,
source_addr_npi=AddrNpi.ISDN,
dest_addr_ton=AddrTon.INTERNATIONAL,
dest_addr_npi=AddrNpi.ISDN,
)
self.do_conversion_test(PDUEncoder(), pdu, '000000470000000400000000000000020001013338353931353232323635360001013338353935333932363939320000000000000100f1000e6a736d7465737432206463206631')


def test_decode_command_length_too_short(self):
self.do_decode_corrupt_data_error_test(PDUEncoder().decode, CommandStatus.ESME_RINVCMDLEN, '0000000f000000060000000000000000')

Expand Down

0 comments on commit 7aabfd5

Please sign in to comment.