Esempio n. 1
0
def test_02_enquirelink_decode():
    "Test EnquireLink decoding"
    
    data = b'\x00\x00\x00\x10\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x01'

    P = EnquireLink.decode(data)
    assert '00 00 00 10 00 00 00 15 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(),150)
def test_04_cancel_sm_resp_decode():
    "Test Cancel Response Sm Decoding"

    data = b'\x00\x00\x00\x10\x80\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01'

    P = CancelSmResp.decode(data)
    assert '00 00 00 10 80 00 00 08 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(), 150)
Esempio n. 3
0
def test_02_unbind_decode():
    "Test UnBind decoding"
    
    data = b'\x00\x00\x00\x10\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x01'

    P = UnBind.decode(data)
    assert '00 00 00 10 00 00 00 06 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(),150)
def test_04_replace_sm_resp_decode():
    "Test Replace Response Sm Decoding"

    data = b'\x00\x00\x00\x10\x80\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x01'

    P = ReplaceSmResp.decode(data)
    assert '00 00 00 10 80 00 00 07 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(), 150)
Esempio n. 5
0
def test_01_unbind_rsp_encode():
    "Test UnBindResp encoding"
    
    P = UnBindResp()
    #P.command_id = Integer(command_ids.unbind_resp, 4)
    
    assert '00 00 00 10 80 00 00 06 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(), 150)
Esempio n. 6
0
def test_02_sbmit_sm_decode():

    "Test Submit Sm decoding"

    data = b'\x00\x00\x008\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x01ASMA\x00\x01\x01+923335111156\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x05hello\x00'

    P = SubmitSm.decode(data)
    assert '00 00 00 38 00 00 00 04 00 00 00 00 00 00 00 01 00 01 01 41 53 4D 41 00 01 01 2B 39 32 33 33 33 35 31 31 31 31 35 36 00 00 00 00 00 00 00 01 00 00 05 \n68 65 6C 6C 6F 00 ' == hex_convert(P.encode(), 150)
Esempio n. 7
0
def test_02_hex_convert_with_line_size():
    "Test to check hex_convert with a given line size"

    assert '48 65 6C 6C \n6F 20 57 6F \n72 6C 64 21 \n' == hex_convert("Hello World!", 12)
Esempio n. 8
0
def test_01_integer_encode():
    "Test to check 1, 2 and 4 byte integer encoding"

    assert '05 ' == hex_convert(Integer(5, 1).encode())
    assert 'A3 12 ' == hex_convert(Integer(41746, 2).encode())
    assert '01 D9 5E 1F ' == hex_convert(Integer(31022623, 4).encode())
Esempio n. 9
0
def test_01_pdu_encode():
    "Test PDU encoding"
    P = PDU()
    assert '00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode())
Esempio n. 10
0
def test_04_submit_multi_response_decode():
    "Test Submit Multi Response Decoding"

    data = b'\x00\x00\x00\x1d\x80\x00\x00\x21\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x01\x011515\x00\x00\x00\x00\x00'
    P = SubmitMultiResp.decode(data)
    assert '00 00 00 1D 80 00 00 21 00 00 00 00 00 00 00 01 00 00 01 01 31 35 31 35 00 00 00 00 00 ' == hex_convert(P.encode(), 150)
Esempio n. 11
0
def test_03_submit_multi_response_encode():

    "Test Submit Multi Response Encoding"
    P = SubmitMultiResp()
    P.destination_addr = CString("1515")
    assert '00 00 00 1D 80 00 00 21 00 00 00 00 00 00 00 01 00 00 01 01 31 35 31 35 00 00 00 00 00 ' == hex_convert(P.encode(), 150)
Esempio n. 12
0
def test_01_submit_multi_encode():
    "Test Submit Multi Encoding"

    P = SubmitMulti()
    P = SubmitMulti()
    P.source_addr = CString("ASMA")
    P.number_of_dests = Integer(2, 1)
    P.destination_addr = CString("+923005381993\n+923365195924")
    P.sm_length = Integer(5, 1)
    P.short_message = CString("hello")


    assert '00 00 00 4A 00 00 00 21 00 00 00 00 00 00 00 01 00 01 01 41 53 4D 41 00 02 01 01 01 2B 39 32 33 30 30 35 33 38 31 39 39 33 0A 2B 39 32 33 33 36 35 31 \n39 35 39 32 34 00 02 00 00 00 00 00 00 00 01 00 00 05 68 65 6C 6C 6F 00 ' == hex_convert(P.encode(), 150)
Esempio n. 13
0
def test_03_query_sm_resp_encode():
    "Test Query Sm Response Encoding"
    P = QuerySmResp()
    P.command_id = Integer(command_ids.query_sm_resp, 4)
    P.message_id = CString("2")
    P.final_date = CString("2013-10-07 00:00:00")
    P.message_state = Integer(message_state.SCHEDULED, 1)
    P.error_code = Integer(0, 1)
    assert '00 00 00 28 80 00 00 03 00 00 00 00 00 00 00 01 32 00 32 30 31 33 2D 31 30 2D 30 37 20 30 30 3A 30 30 3A 30 30 00 00 00 ' == hex_convert(P.encode(), 150)
Esempio n. 14
0
def test_02_query_sm_decode():

    "Test Query Sm decoding"
    data = b'\x00\x00\x00\x19\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x012\x00\x01\x01ASMA\x00'

    P = QuerySm.decode(data)
    assert '00 00 00 19 00 00 00 03 00 00 00 00 00 00 00 01 32 00 01 01 41 53 4D 41 00 ' == hex_convert(P.encode(), 150)
Esempio n. 15
0
def test_03_replace_sm_resp_encode():
    "Test Replace Sm Response Encoding"
    P = ReplaceSmResp()
    P.command_id = Integer(command_ids.replace_sm_resp, 4)

    assert '00 00 00 10 80 00 00 07 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(), 150)
Esempio n. 16
0
def test_02_replace_sm_decode():

    "Test Replace Sm decoding"
    data = b'\x00\x00\x00$\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x012\x00\x01\x01ASMA\x00\x00\x00\x00\x00\x05hello\x00'

    P = ReplaceSm.decode(data)
    assert '00 00 00 24 00 00 00 07 00 00 00 00 00 00 00 01 32 00 01 01 41 53 4D 41 00 00 00 00 00 05 68 65 6C 6C 6F 00 ' == hex_convert(P.encode(), 150)
Esempio n. 17
0
def test_01_replace_sm_encode():
    "Test Replace Sm encoding"
    P = ReplaceSm()
    P.command_id = Integer(command_ids.replace_sm, 4)
    P.message_id = CString("2")
    P.source_addr_ton = Integer(TON.INTERNATIONAL, 1)
    P.source_addr_npi = Integer(NPI.ISDN, 1)
    P.source_addr = CString("ASMA")
    P.schedule_delivery_time = CString("")
    P.validity_period = CString("")
    P.registered_delievery = Integer(0, 1)
    P.sm_default_msg_id = Integer(0, 1)
    P.sm_length = Integer(5, 1)                # page 134
    P.short_message = CString("hello")

    assert '00 00 00 24 00 00 00 07 00 00 00 00 00 00 00 01 32 00 01 01 41 53 4D 41 00 00 00 00 00 05 68 65 6C 6C 6F 00 ' == hex_convert(P.encode(), 150)
Esempio n. 18
0
def test_03_sbmit_sm_resp_encode():
    "Test Submit Sm Encoding"
    P = SubmitSmResp()
    P.message_id = CString("2468ACE")
    assert '00 00 00 18 80 00 00 04 00 00 00 00 00 00 00 01 32 34 36 38 41 43 45 00 ' == hex_convert(P.encode(), 150)
Esempio n. 19
0
def test_04_sbmit_sm_resp_decode():
    "Test Submit Sm Decoding"

    data = b'\x00\x00\x00\x18\x80\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x012468ACE\x00'

    P = SubmitSmResp.decode(data)
    assert '00 00 00 18 80 00 00 04 00 00 00 00 00 00 00 01 32 34 36 38 41 43 45 00 ' == hex_convert(P.encode(), 150)
Esempio n. 20
0
def test_04_query_sm_resp_decode():
    "Test Query Response Sm Decoding"

    data = b'\x00\x00\x00(\x80\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x012\x002013-10-07 00:00:00\x00\x00\x00'

    P = QuerySmResp.decode(data)
    assert '00 00 00 28 80 00 00 03 00 00 00 00 00 00 00 01 32 00 32 30 31 33 2D 31 30 2D 30 37 20 30 30 3A 30 30 3A 30 30 00 00 00 ' ==  hex_convert(P.encode(), 150)
Esempio n. 21
0
def test_02_submit_multi_decode():
    "Test Submit Multi Decoding"
    data = b'\x00\x00\x00J\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x01ASMA\x00\x02\x01\x01\x01+923005381993\n+923365195924\x00\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x05hello\x00'
    P = SubmitMulti.decode(data)

    assert '00 00 00 4A 00 00 00 21 00 00 00 00 00 00 00 01 00 01 01 41 53 4D 41 00 02 01 01 01 2B 39 32 33 30 30 35 33 38 31 39 39 33 0A 2B 39 32 33 33 36 35 31 \n39 35 39 32 34 00 02 00 00 00 00 00 00 00 01 00 00 05 68 65 6C 6C 6F 00 ' == hex_convert(P.encode(), 150)
Esempio n. 22
0
def test_01_cancel_sm_encode():
    "Test Cancel Sm encoding"
    P = CancelSm()
    P.command_id = Integer(command_ids.cancel_sm, 4)
    P.service_type = CString("")
    P.message_id = CString("2")
    P.source_addr_ton = Integer(TON.INTERNATIONAL, 1)
    P.source_addr_npi = Integer(NPI.ISDN, 1)
    P.source_addr = CString("ASMA")
    P.dest_addr_ton = Integer(TON.INTERNATIONAL, 1)
    P.dest_addr_npi = Integer(NPI.ISDN, 1)
    P.destination_addr = CString("+923005381993")
    assert '00 00 00 2A 00 00 00 08 00 00 00 00 00 00 00 01 00 32 00 01 01 41 53 4D 41 00 01 01 2B 39 32 33 30 30 35 33 38 31 39 39 33 00 ' == hex_convert(P.encode(), 150)
Esempio n. 23
0
def test_01_sbmit_sm_encode():
    "Test Submit Sm encoding"
    P = SubmitSm()
    P.service_type = CString("")
    P.source_addr_ton = Integer(TON.INTERNATIONAL, 1)
    P.source_addr_npi = Integer(NPI.ISDN, 1)
    P.source_addr = CString("ASMA")
    P.dest_addr_ton = Integer(TON.INTERNATIONAL, 1)
    P.dest_addr_npi = Integer(NPI.ISDN, 1)
    P.destination_addr = CString("+923335111156")
    P.esm_class = Integer(esm_class.Default_mode, 1)
    P.protocol_id = Integer(0, 1)
    P.priority_flag = Integer(0, 1)
    P.schedule_delivery_time = CString("")
    P.validity_period = CString("")
    P.registered_delievery = Integer(0, 1)
    P.replace_if_present_flag = Integer(1, 1)
    P.data_coding = Integer(0, 1)
    P.sm_default_msg_id = Integer(0, 1)
    P.sm_length = Integer(5, 1)
    P.short_message = CString("hello")

    assert '00 00 00 38 00 00 00 04 00 00 00 00 00 00 00 01 00 01 01 41 53 4D 41 00 01 01 2B 39 32 33 33 33 35 31 31 31 31 35 36 00 00 00 00 00 00 00 01 00 00 05 \n68 65 6C 6C 6F 00 ' == hex_convert(P.encode(), 150)
Esempio n. 24
0
def test_02_cancel_sm_decode():

    "Test Cancel Sm decoding"
    data = b'\x00\x00\x00*\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x002\x00\x01\x01ASMA\x00\x01\x01+923005381993\x00'

    P = CancelSm.decode(data)
    assert '00 00 00 2A 00 00 00 08 00 00 00 00 00 00 00 01 00 32 00 01 01 41 53 4D 41 00 01 01 2B 39 32 33 30 30 35 33 38 31 39 39 33 00 ' == hex_convert(P.encode(), 150)
Esempio n. 25
0
def test_02_pdu_decode():
    "Test PDU decoding"
    P = PDU.decode(b'\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01')
    assert '00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode())
Esempio n. 26
0
def test_03_cancel_sm_resp_encode():
    "Test Cancel Sm Response Encoding"
    P = CancelSmResp()
    P.command_id = Integer(command_ids.cancel_sm_resp, 4)

    assert '00 00 00 10 80 00 00 08 00 00 00 00 00 00 00 01 ' == hex_convert(P.encode(), 150)
Esempio n. 27
0
def test_03_cstring_encode():
    "Test to check CString encoding"

    assert '48 65 6C 6C 6F 00 ' == hex_convert(CString(b"Hello").encode())
    assert '31 32 33 34 35 36 37 38 39 00 ' == hex_convert(CString(b"123456789").encode())
    assert '41 32 46 35 45 44 32 37 38 46 43 00 ' == hex_convert(CString(b"A2F5ED278FC").encode())
Esempio n. 28
0
def test_01_query_sm_encode():
    "Test Query Sm encoding"
    P = QuerySm()
    P. command_id = Integer(command_ids.query_sm, 4)
    P.message_id = CString("2")
    P.source_addr_ton = Integer(TON.INTERNATIONAL, 1)
    P.source_addr_npi = Integer(NPI.ISDN, 1)
    P.source_addr = CString("ASMA")

    assert '00 00 00 19 00 00 00 03 00 00 00 00 00 00 00 01 32 00 01 01 41 53 4D 41 00 ' == hex_convert(P.encode(), 150)
Esempio n. 29
0
def test_07_tlv_encode():
    "Test to check TLV encoding"

    assert '00 07 00 01 04 ' == hex_convert(TLV(0x0007, 0x04).encode())
    assert 1 == TLV(0x0007, 0x04).length.value
Esempio n. 30
0
def test_01_hex_convert():
    "Test to check hex_convert"

    assert '48 65 6C 6C 6F 20 57 6F 72 6C 64 21 ' == hex_convert("Hello World!")