Exemple #1
0
def test_serialize_multi_values():
    hdr = Header(b'Via')
    hdr.add_value(
        b'SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1')
    hdr.add_value(b'SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds')
    assert b'Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1\r\nVia: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds' == hdr.serialize_to_bytes(
    )
    assert 'Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1\r\nVia: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds' == hdr.serialize_to_string(
    )
Exemple #2
0
def test_serialize_single_value():
    hdr = Header('Content-Length')
    hdr.add_value('10')
    assert b'Content-Length: 10' == hdr.serialize_to_bytes()
    assert 'Content-Length: 10' == hdr.serialize_to_string()