Current File : //proc/self/root/lib/python3/dist-packages/twisted/test/__pycache__/test_sip.cpython-312.pyc |
�
Ϫ�f�c � � � d Z ddlmZmZ ddlmZmZ ddlmZ ddl m
Z
ddlmZ ddlmZ d d
j! dd� z Zd
j! dd� Zdj! dd� Zdj! dd� Zdj! dd� Zdj! dd� Zdj! dd� Zdj! dd� Z G d� d� Z G d� de
j4 � Z G d� de� Z G d� de
j4 � Z G d� de
j4 � Z G d� de
j4 � Z G d � d!e
j4 � Z eejB � G d"� d#� � Z" eejB � G d$� d%� � Z# G d&� d'e
j4 � Z$ G d(� d)e
j4 � Z% G d*� d+ejL � Z' G d,� d-e
j4 � Z(y# e
$ r dZY ���w xY w).z(
Session Initialization Protocol tests.
� )�checkers�portal)�defer�reactor)�sip)�unittest)�AsyncioSelectorReactorN)�implementerz
z?INVITE sip:foo SIP/2.0
From: mo
To: joe
Content-Length: 4
abcd�
z
z-INVITE sip:foo SIP/2.0
From: mo
To: joe
1234zHINVITE sip:foo SIP/2.0
From: mo
To: joe
Content-Length: 4
1234
lalalalz�INVITE sip:foo SIP/2.0
From: mo
To: joe
Content-Length: 0
INVITE sip:loop SIP/2.0
From: foo
To: bar
Content-Length: 4
abcdINVITE sip:loop SIP/2.0
From: foo
To: bar
Content-Length: 4
1234z4SIP/2.0 200 OK
From: foo
To:bar
Content-Length: 0
z.INVITE sip:foo SIP/2.0
f: mo
t: joe
l: 4
abcdz=INVITE sip:foo SIP/2.0
Via: SIP/2.0/UDP 10.0.0.1:5060;rport
a� SIP/2.0 200 OK
Via: SIP/2.0/UDP server10.biloxi.com
;branch=z9hG4bKnashds8;received=192.0.2.3
Via: SIP/2.0/UDP bigbox3.site3.atlanta.com
;branch=z9hG4bK77ef4c2312983.1;received=192.0.2.2
Via: SIP/2.0/UDP pc33.atlanta.com
;branch=z9hG4bK776asdhds ;received=192.0.2.1
To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710@pc33.atlanta.com
CSeq: 314159 INVITE
Contact: <sip:bob@192.0.2.4>
Content-Type: application/sdp
Content-Length: 0
c � � e Zd Zd� Zy)� TestRealmc �* � t j d d� fS )Nc � � y �N� r � �7/usr/lib/python3/dist-packages/twisted/test/test_sip.py�<lambda>z)TestRealm.requestAvatar.<locals>.<lambda>� s � r )r �IContact)�self�avatarId�mind�
interfacess r �
requestAvatarzTestRealm.requestAvatar s � ��|�|�T�<�/�/r N)�__name__�
__module__�__qualname__r r r r r
r
~ s � �0r r
c �H � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zy)�MessageParsingTestsc �n � g | _ t j | j j � | _ y r )�lr �MessagesParser�append�parser�r s r �setUpzMessageParsingTests.setUp� s# � �����(�(������7��r c �n � | j j |� | j j � y r �r$ �dataReceived�dataDone)r �messages r �feedMessagezMessageParsingTests.feedMessage� s$ � ���� � ��)������r c �8 � | j |j |� | j |j j � |� | j |j |� | j |j
|� | j |j d� y)z$
Validate Requests.
� N)�assertEqual�method�uri�toString�headers�body�finished)r �mr0 r1 r3 r4 s r �validateMessagez#MessageParsingTests.validateMessage� so � �
������6�*���������)�3�/�������G�,��������&�������Q�'r c � � | j }| j t � | j t |� d� | j |d dddgdgdgd�d � y �
Nr. r �INVITE�sip:foo�mo�joe�4��from�tozcontent-length�abcd)r! r, �request1r/ �lenr7 �r r! s r �
testSimplezMessageParsingTests.testSimple� �[ � ��F�F������"�����Q���#����
�a�D����V�E�7�s�e�D��
r c � � | j }| j t � | j t � | j t |� d� | j
|d dddgdgdgd�d � | j
|d
dddgdgd�d� y )
N� r r: r; r<