U
    •uÄc  ã                   @   s@   d dl Z d dlmZmZ G dd„ de jƒZG dd„ de jƒZdS )é    N)Ú
create_urlÚ	parse_urlc                   @   s„   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS ) ÚTestCreateWsUrlc                 C   s   |   tdƒd¡ d S )NÚ	localhostzws://localhost:80/©ÚassertEqualr   ©Úself© r
   úuc:\users\psant\downloads\hotstarbackend\school\venv38\Lib\site-packages\autobahn\websocket\test\test_websocket_url.pyÚtest_create_url01"   s    z!TestCreateWsUrl.test_create_url01c                 C   s   |   tddd�d¡ d S )Nr   iš  )Úportzws://localhost:8090/r   r   r
   r
   r   Útest_create_url02%   s    z!TestCreateWsUrl.test_create_url02c                 C   s   |   tddd�d¡ d S )Nr   Úws©Úpathúws://localhost:80/wsr   r   r
   r
   r   Útest_create_url03(   s    z!TestCreateWsUrl.test_create_url03c                 C   s   |   tddd�d¡ d S )Nr   ú/wsr   r   r   r   r
   r
   r   Útest_create_url04+   s    z!TestCreateWsUrl.test_create_url04c                 C   s   |   tddd�d¡ d S )Nr   z
/ws/foobarr   zws://localhost:80/ws/foobarr   r   r
   r
   r   Útest_create_url05.   s    z!TestCreateWsUrl.test_create_url05c                 C   s   |   tddd�d¡ d S )Nr   T)ÚisSecureúwss://localhost:443/r   r   r
   r
   r   Útest_create_url061   s    z!TestCreateWsUrl.test_create_url06c                 C   s   |   tdddd�d¡ d S )Nr   Té»  ©r   r   r   r   r   r
   r
   r   Útest_create_url074   s    z!TestCreateWsUrl.test_create_url07c                 C   s   |   tdddd�d¡ d S )Nr   TéP   r   zwss://localhost:80/r   r   r
   r
   r   Útest_create_url087   s    z!TestCreateWsUrl.test_create_url08c              	   C   s"   |   tddddddid�d¡ d S )	Nr   Té‚#  r   ÚfooÚbar©r   r   r   Úparamszwss://localhost:9090/ws?foo=barr   r   r
   r
   r   Útest_create_url09:   s    z!TestCreateWsUrl.test_create_url09c                 C   s2   t dddddddœd�}|  |d	kp*|d
k¡ d S )Nr   Tr   r   r!   é   )r    Úmoor"   z&wss://localhost:9090/ws?foo=bar&moo=23z&wss://localhost:9090/ws?moo=23&foo=bar)r   Ú
assertTrue)r	   Zwsurlr
   r
   r   Útest_create_url10=   s    z!TestCreateWsUrl.test_create_url10c                 C   s   |   tddd�d¡ d S )Nz	127.0.0.1r   r   zws://127.0.0.1:80/wsr   r   r
   r
   r   Útest_create_url11A   s    z!TestCreateWsUrl.test_create_url11c                 C   s   |   tddd�d¡ d S )Nz62.146.25.34r   r   zws://62.146.25.34:80/wsr   r   r
   r
   r   Útest_create_url12D   s    z!TestCreateWsUrl.test_create_url12c                 C   s   |   tddd�d¡ d S )Nzsubsub1.sub1.something.comr   r   z%ws://subsub1.sub1.something.com:80/wsr   r   r
   r
   r   Útest_create_url13G   s    z!TestCreateWsUrl.test_create_url13c                 C   s   |   tddd�d¡ d S )Nz::1r   r   zws://::1:80/wsr   r   r
   r
   r   Útest_create_url14J   s    z!TestCreateWsUrl.test_create_url14c                 C   s   |   tddd�d¡ d S )Nz0:0:0:0:0:0:0:1r   r   zws://0:0:0:0:0:0:0:1:80/wsr   r   r
   r
   r   Útest_create_url15M   s    z!TestCreateWsUrl.test_create_url15N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r$   r(   r)   r*   r+   r,   r-   r
   r
   r
   r   r       s   r   c                   @   s|   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚTestParseWsUrlc              	   C   s    |   tdƒdddddi f¡ d S )Nzws://localhostFr   r   ú/©r   r   r   r
   r
   r   Útest_parse_url01U   s    zTestParseWsUrl.test_parse_url01c              	   C   s    |   tdƒdddddi f¡ d S )Nzws://localhost:80Fr   r   r2   r3   r   r
   r
   r   Útest_parse_url02X   s    zTestParseWsUrl.test_parse_url02c              	   C   s    |   tdƒdddddi f¡ d S )Nzwss://localhostTr   r   r2   r3   r   r
   r
   r   Útest_parse_url03[   s    zTestParseWsUrl.test_parse_url03c              	   C   s    |   tdƒdddddi f¡ d S )Nzwss://localhost:443Tr   r   r2   r3   r   r
   r
   r   Útest_parse_url04^   s    zTestParseWsUrl.test_parse_url04c              	   C   s    |   tdƒdddddi f¡ d S )Nzwss://localhost/wsTr   r   r   r3   r   r
   r
   r   Útest_parse_url05a   s    zTestParseWsUrl.test_parse_url05c              
   C   s&   |   tdƒdddddddgif¡ d S )	Nzwss://localhost/ws?foo=barTr   r   z/ws?foo=barr   r    r!   r3   r   r
   r
   r   Útest_parse_url06d   s    zTestParseWsUrl.test_parse_url06c                 C   s*   |   tdƒddddddgdgd	œf¡ d S )
Nz!wss://localhost/ws?foo=bar&moo=23Tr   r   z/ws?foo=bar&moo=23r   Ú23r!   ©r&   r    r3   r   r
   r
   r   Útest_parse_url07g   s    zTestParseWsUrl.test_parse_url07c                 C   s,   |   tdƒdddddddgd	gd
œf¡ d S )Nz(wss://localhost/ws?foo=bar&moo=23&moo=44Tr   r   z/ws?foo=bar&moo=23&moo=44r   r:   Z44r!   r;   r3   r   r
   r
   r   Útest_parse_url08j   s    zTestParseWsUrl.test_parse_url08c                 C   s   |   ttd¡ d S )Nzhttp://localhost©ÚassertRaisesÚ	Exceptionr   r   r
   r
   r   Útest_parse_url09m   s    zTestParseWsUrl.test_parse_url09c                 C   s   |   ttd¡ d S )Nzhttps://localhostr>   r   r
   r
   r   Útest_parse_url10p   s    zTestParseWsUrl.test_parse_url10c                 C   s   |   ttd¡ d S )Nzhttp://localhost:80r>   r   r
   r
   r   Útest_parse_url11s   s    zTestParseWsUrl.test_parse_url11c                 C   s   |   ttd¡ d S )Nzhttp://localhost#frag1r>   r   r
   r
   r   Útest_parse_url12v   s    zTestParseWsUrl.test_parse_url12c                 C   s   |   ttd¡ d S )Nzwss://r>   r   r
   r
   r   Útest_parse_url13y   s    zTestParseWsUrl.test_parse_url13c                 C   s   |   ttd¡ d S )Nzws://r>   r   r
   r
   r   Útest_parse_url14|   s    zTestParseWsUrl.test_parse_url14N)r.   r/   r0   r4   r5   r6   r7   r8   r9   r<   r=   rA   rB   rC   rD   rE   rF   r
   r
   r
   r   r1   Q   s   r1   )ÚunittestZautobahn.websocket.utilr   r   ÚTestCaser   r1   r
   r
   r
   r   Ú<module>   s   1