def test_01_bind_tcr_encode(): "test Bind Transceivr encoding" P = BindTransceiver() P.system_id = CString("SMPP3TEST") P.password = CString("secret08") P.system_type = CString("SUBMIT1") P.interface_version = Integer(IV.SMPP_VERSION_5, 1) P.addr_ton = Integer(TON.INTERNATIONAL, 1) P.addr_npi = Integer(NPI.ISDN, 1) P.address_range = CString('') assert '00 00 00 2F 00 00 00 09 00 00 00 00 00 00 00 01 53 4D 50 50 33 54 45 53 54 00 73 65 63 72 65 74 30 38 00 53 55 42 4D 49 54 31 00 50 01 01 00 ' == hex_convert(P.encode(), 150)
def test_02_bind_tcr_decode(): "Test Bind Transceiver decoding" data = data = b'\x00\x00\x00/\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x01SMPP3TEST\x00secret08\x00' + \ b'SUBMIT1\x00P\x01\x01\x00' P = BindTransceiver.decode(data) assert '00 00 00 2F 00 00 00 09 00 00 00 00 00 00 00 01 53 4D 50 50 33 54 45 53 54 00 73 65 63 72 65 74 30 38 00 53 55 42 4D 49 54 31 00 50 01 01 00 ' == hex_convert(P.encode(), 150)