Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
lib
/
python3
/
dist-packages
/
websocket
/
tests
/
__pycache__
/
Filename :
test_abnf.cpython-310.pyc
back
Copy
o _7�aO � @ sF d Z ddlZddlT ddlZG dd� dej�Zedkr!e�� dS dS )ac test_abnf.py websocket - WebSocket client library for Python Copyright 2021 engn33r Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. � N)�*c @ s4 e Zd Zdd� Zdd� Zdd� Zdd� Zd d � ZdS )�ABNFTestc C s� t ddddt jd�}| �|jd� | �|jd� | �|jd� | �|jd� | �|jd� | �|jd� t dddddd�}| �|jd� | �|jd� d S )Nr ��opcode� � � �M ) �ABNF�OPCODE_PING�assertEqual�fin�rsv1�rsv2�rsv3r �data)�self�a�a_bad� r �;/usr/lib/python3/dist-packages/websocket/tests/test_abnf.py�testInit s zABNFTest.testInitc C s t ddddt jd�}| jtjj|jdd� t ddddt jd�}| jtjj|jdd� t dddddd�}| jtjj|jdd� t ddddt jdd�}| jtjj|jdd� t ddddt jd d�}| jtjj|jdd� t ddddt jd d�}| jtjj|jdd� d S )Nr r F)�skip_utf8_validationr r � �r r s ����s �T) r r �assertRaises�ws�_exceptions�WebSocketProtocolException�validate�OPCODE_TEXT�OPCODE_CLOSE)r �a_invalid_ping�a_bad_rsv_value�a_bad_opcode�a_bad_close_frame�a_bad_close_frame_2�a_bad_close_frame_3r r r �testValidate) s zABNFTest.testValidatec C s\ t ddddt jdd d�}d}| �|�|�|� t ddddt jddd�}| �|�|�d� d S )Nr r �r �maskr s aaaar s aaaa )r r r �_get_masked)r �abnf_none_data� bytes_val� abnf_str_datar r r �testMask7 s zABNFTest.testMaskc C s t ddddt jd�}| �t|j� t dddddd�}| �t|j� t ddddt jdd�}| �d|�� d �dd �� | �d |�� d �dd �� | �d|�� � t ddddt jdd�}| �d |�� d �dd �� | �d|�� d �dd �� t ddddt jddd�}| �d|�� � d S )N� r r � � abcdefghijr r r �big� �zfin=0 opcode=1 data=abcdefghij�abcdefghijabcdefghij� � �s ��r) s ��) r r r � ValueError�formatr �to_bytes�__str__� OPCODE_BINARY)r �abnf_bad_rsv_bits�abnf_bad_opcode�abnf_length_10�abnf_length_20�abnf_no_maskr r r � testFormat>