AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.142.252.129
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.pyo
�
j^�Xc@�s!dZddlmZddlmZer?ddlmZnddlmZddlZddl	m
Z
ddlZeje
�ZddlZddlZddlmZddlmZmZdd	lmZmZdd
lmZmZddlmZmZmZmZm Z m!Z!ddl"j#j$Z%ddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,dd
l-m.Z.m/Z0m1Z2m3Z3ej4j5ej4j6e7��Z8d�Z9de'fd��YZ:ddl;Z;ddl<Z<de%j=fd��YZ>de%j=fd��YZ?de'fd��YZ@dS(stests for passlib.contexti����(twith_statement(tPY3(tNoSectionErrorN(tpartial(thash(tCryptContexttLazyCryptContext(tPasslibConfigWarningtPasslibHashWarning(ttickt
to_unicode(tirangetutunicodet
str_to_uasciitPY2tPY26(tTestCasetset_filetTICK_RESOLUTIONt
quicksleept	time_callthandler_derived_from(tregister_crypt_handler_patht_has_crypt_handlert_unload_handler_nametget_crypt_handlercO�sD|j�}x|D]}|j|�qW|r@|j|�n|S(N(tcopytupdate(tfirsttargstkwdsttargettarg((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytmerge_dicts&s
tCryptContextTestcB�s�eZdZddddgZgeD]Zee�^q%Zededdddd	d
ddd
ddd�Ze	ede�Z
ed�Zed�Z
ejjed�Ze
jed�ed��Zejjed�Ze
jed�ed��jd�Zejjed�ZerNeee
�eee�eee�neddd	ddddd�Zd Ze	ee�Zedd�Ze	ee�Zedddd!dd"gd#dgdd"d	d$dd%d&d'd(d)d*d+d,d)d-d.d/d0�Z d1�Z!d2�Z"d3�Z#d4�Z$d5�Z%d6�Z&d7�Z'd8�Z(d9�Z)d:�Z*d;�Z+d<�Z,d=�Z-d>�Z.dZd?�Z0d@�Z1dA�Z2dB�Z3dC�Z4dD�Z5dE�Z6dZifdZiddF6fdGifd[ifgZ7dH�Z8dI�Z9dJ�Z:dK�Z;edL�Z<dM�Z=dN�Z>dO�Z?dP�Z@dQ�ZAdR�ZBdS�ZCdT�ZDdU�ZEdV�ZFdW�ZGdX�ZHdY�ZIRS(\Rt	des_cryptt	md5_cryptt
bsdi_crypttsha512_crypttschemestdefaulttall__vary_roundsg�������?tbsdi_crypt__max_roundsi1utbsdi_crypt__default_roundsi�atsha512_crypt__max_roundsiP�tsha512_crypt__min_roundsi@�s[passlib]
schemes = des_crypt, md5_crypt, bsdi_crypt, sha512_crypt
default = md5_crypt
; this is using %...
all__vary_rounds = 10%%
bsdi_crypt__default_rounds = 25001
bsdi_crypt__max_rounds = 30001
sha512_crypt__max_rounds = 50000
sha512_crypt__min_rounds = 40000
s�[passlib]
schemes = des_crypt, md5_crypt, bsdi_crypt, sha512_crypt
default = md5_crypt
all__vary_rounds = 0.1
bsdi_crypt__default_rounds = 25001
bsdi_crypt__max_rounds = 30001
sha512_crypt__max_rounds = 50000
sha512_crypt__min_rounds = 40000

ssample1.cfgs
s
ssample1b.cfgs	[passlib]s
[mypolicy]sutf-16ssample1c.cfgtbsdi_crypt__min_roundsiIqi��iyiȯs�[passlib]
bsdi_crypt__min_rounds = 29001
bsdi_crypt__max_rounds = 35001
bsdi_crypt__default_rounds = 31001
sha512_crypt__min_rounds = 45000
tphpasstsha256_cryptt
deprecatediitbsdi_crypt__vary_roundsitsha256_crypt__max_roundsi�tsha256_crypt__min_roundsi�tsha256_crypt__default_roundst
phpass__identtHtphpass__default_roundsicC�s7tt|�j�tjdd�tjdd�dS(Ntignores The 'all' scheme is deprecated.*s4.*'scheme' keyword is deprecated as of Passlib 1.7.*(tsuperR#tsetUptwarningstfilterwarnings(tself((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR<�scC�s�t�}|j|j�i�t|j�}|j|j�|j�t|j�}|j|j�|j�t|j�}|j|j�|j�t|j�}|j|j�|j�tdtd�g�}|j|j�d�dS(stest class constructorR(R1N(ssha256_crypt(	RtassertEqualtto_dictt
sample_1_dicttsample_1_resolved_dictt
sample_2_dictt
sample_3_dictRR((R?tctx((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_01_constructor�s	cC�s%tj|j�}|j|j�|j�tj|j�}|j|j�|j�tj|jjd��}|j|j�|j�tj|j�}|j|j�|j�tj|j	dddd�}|j|j�|j�|j
ttjd�|j
t
tj|jdd�dS(stest from_string() constructorsutf-8tsectiontmypolicytencodingsutf-16tfakesectionN(Rtfrom_stringtsample_1_unicodeR@RARBtsample_1_unnormalizedtencodetsample_1b_unicodetsample_1c_bytestassertRaisest	TypeErrortNoneR(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_02_from_string�s	cC�stjj|j�s+td|j��ntj|j�}|j|j�|j	�tj|j
�}|j|j�|j	�tj|jdddd�}|j|j�|j	�|jt
tjtjjtd��|jttj|jdd�dS(	stest from_path() constructorscan't find data file: %rRHRIRJsutf-16ssample1xxx.cfgRKN(tostpathtexistst
sample_1_pathtRuntimeErrorRt	from_pathR@RARBtsample_1b_pathtsample_1c_pathRRtEnvironmentErrortjointhereR(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_03_from_path�s	cC�sVt|j�}|j|j�}|j|j�|j�|j|j�|j�|j|j�}|j|j�|j�|j|j�|j�|j|j�}|j|j�|j�|j�}|j	||�|j|j�|j�|j|j�|j�|j
|j�|j|j�|j�|j|j�|j�dS(stest copy() methodN(RRBRRDR@RAtsample_12_dictREtsample_123_dicttassertIsNotR(R?tcc1tcc2tcc2btcc3tcc4((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_04_copys cC�s)t|j�}|jt|�d�dS(stest repr()s!^<CryptContext at 0x-?[0-9a-f]+>$N(RRBtassertRegextrepr(R?Re((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_09_repr+scC�s$t�}|j|j�|j|j�|j�|j|j�|j|j�|j�|j|jjd��|j|j�|j�|jt|jd�t|j�}|jidt
�|j|j�|j�t�}|j|j�|j|j�|j|j�|j�dS(s test load() / load_path() methodsutf-8RN(RtloadRBR@RARMRORRRSRTtTrueRD(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_10_load4s	
	cC�s�tddgdddd�}|j�}|jt|jdt�|j|j�|�|jt|jdt�|j|j�|�|jt|jd	d
�|j|j�|�dS(s$test load() errors restore old stateR$R1R6i�R*g�������?ttoo__many__key__partstfake_context_optionR5i'N(	Rt	to_stringRRRSRRoR@tKeyErrort
ValueError(R?tcctresult((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_11_load_rollback_s	cC�sUt|j�}|j�|j|j�|j�t|j�}|j|j�|j|j�|j�|j|j�|j|j�|j�t|j�}|j|j�|j|j�|j�t|j�}|j|j	�|j|j�|j�|j
t|jii�|j
t|jiddg�|j
t|jd�dS(stest update() methodR(R$N(
RRBRR@RARDRbRERctsample_2_unicodeRRRSRT(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_12_updatews"
cC�s�d�}|jttdd�|jttdd�|jttdd�|jttdd�|jttdd�|jttd	d
�|jt|idd6�tid
d6dd6�}|j|jd�d�tdd�}|j|dd�|�|j|dd�|�|j|dd�|�|j|idd6�|�|j|idd6�|�tdd�}|j|dd�|�|j|idd6�|�tdd�}|j|dd�|�|j|dd�|�|j|idd6�|�|j|idd6�|�tdd�}|j|dd�|�|j|idd6�|�tddgd d!�}|jt|jd"d!�|jttddgd#d$�|jttddgd%d$�d&S('stest basic option parsingc[�st|�j�S(N(RRA(R((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytparse�st__g�������?tdefault__scheme__txt__optiontdefault____optiont__scheme__optiont!category__scheme__option__invalidi0uR%sadmin.context__schemessmd5_crypt,des_cryptR(R$sadmin.context__defaulttadminR)tcontext__defaulttdefault__context__defaultscontext.defaultsdefault.context.defaulttadmin__context__defaultsadmin.context.defaultR*tdefault__all__vary_roundssall.vary_roundssdefault.all.vary_roundstadmin__all__vary_roundssadmin.all.vary_roundsR0R7tPtmd5_crypt__identtdes_crypt__salttxxt	all__saltN(RRRSRRtR@tdefault_schemetdictR(R?R{RFRw((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_20_options�sH		

cC�sFtdd
�}|j|j�d�tdddg�}|j|j�d�tdd�}|j|j�d
�tdtjtjg�}|j|j�d�|jttdt	j
g�dt	j
fd��Y}|jttd|g�dt	j
fd��Y}|jttd||g�|jttd	dg�d
S(s%test 'schemes' context option parsingR(R$R%s des_crypt, md5_crypt, tnamelesscB�seZdZRS(N(t__name__t
__module__RTtname(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR��stdummy_1cB�seZdZRS(R�(R�R�R�(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR�stadmin__context__schemesN((s	des_crypts	md5_crypt(s	des_crypts	md5_crypt(s	des_crypts	md5_crypt(
RRTR@R(RR$R%RRRStuht
StaticHandlerRuRt(R?RvR�R�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_21_schemes�sc	C�sdd�}tddg�}|jdddg�|j||�dg�tddgdddg�}|j||�dg�|jttdtjgdddg�tddddddg�}|j||�ddg�|jttddgddg�|jt	tddgddg�|jt	tdddgdddg�|jt	tdddgd	ddd�|jt	tdddgd	ddd�|jt	tdddgd
ddd�|jt	tdddgd
ddd�tdddgddd
ddg�|jttdd�tddgdddgddg�}|j||�dg�|j||d�dg�|j||d
�dg�tddgdddgdg�}|j||�dg�|j||d�dg�|j||d
�g�dS(s(test 'deprecated' context option parsingcS�s2g|j�D]!}|j||�jr
|^q
S(N(R(thandlerR2(RFtcategoryR�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytgetdepsR2R%R(R$smd5_crypt,des_cryptR1tadmin__context__deprecatedR)R�i{tuserR�N(
RTRRR@RRRSRR%RtRu(R?R�Rv((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_22_deprecatedsh

	

	cC�s�|jtdd�j�tdd��tdddddg�}|j|j�d�tdtjdddg�}|j|j�d�tdddg�}|j|j�d�|jdd�|j|j�d�|jt	tddgdd�|jt
tdd�tdddddgdd�}|j|j�d�|j|jd�d�|j|jd	�d�d
S(s%test 'default' context option parsingR)R%R(R$R2iR�R�R�N(R@RRAR�R�RR%RRRRtRS(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_23_defaulths&	cC�s{d�}|j|d�d�|j|d�d�|j|d�d�|j|d�d�|j|d�d�dS(s&test 'vary_rounds' hash option parsingcS�std|�j�dS(NR*(RRA(tv((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR{�sg�������?s0.1s10%i�t1000N(R@(R?R{((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_24_vary_rounds�s	cC�s |jt||�d|�dS(Ntmsg(t
assertTrueR(R?R�tbaseR�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytassertHandlerDerivedFrom�scC�st�}|j|j�d�|j|jdt�d�t|j�}|j|j�t|j��|j|jdtdt�t|j��xBt|jdt�|j�D]"\}}|j	t
||��q�Wt|j�}|j|j�d�dS(stest schemes() methodtresolvetunconfiguredN((((RR@R(RoRBttupletsample_1_schemestsample_1_handlerstzipR�RRD(R?RFRwtcorrect((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_30_schemes�s	++cC�s�t�}|jt|j�t|j�}|j|j�d�|j|jdtdt�tj�|j	|jdt�tj�t|j
�}|jt|j�td|j�}|j|j�d�dS(stest default_scheme() methodR%R�R�R(R$N(RRRRtR�RBR@RoRR%R�RDR�(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_31_default_scheme�s	%cC�st�}|jt|j�|jt|jd�t|j�}|j|jdt�tj�|j	|j�tj�|j|jddt�tj
�|j	|jd�tj
�|jt|jd�tddd�}|j|jdt�tj�|j	|j�tj�|j|jdddt�tj�|j	|jdd�tj�|j|jdd	dt�tj�|j	|jdd�tj�tr�|j|jdt
d�dt�tj�|j|jdt
d	�dt�tj�nd
S(stest handler() methodR%R�R$tmysql323ssha256_crypt,md5_cryptR�R�tstaffR�N(RRRRtR�RBR@RoRR%R�R$R1RR(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_32_handler�s&	"%%+cC�s�dd�}tdtddddgdddgdd	d
ddd
dddgdddddd�
}|j|jjd�|j||d�tdtdd	dd
��|j||dd�tdtdd	dd
��|j||dd�tdddd��|j||d�tdtdt��|j||dd�tdtdt��|j||dd�tdtdt��|j||d�tdd��|j||dd�tdd��|j||dd�tdddt��dS(s*test internal _get_record_options() methodcS�s|jj||�dS(Ni(t_configt_get_record_options_with_flag(RFtschemeR�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytoptions�sttruncate_errorR(R'R$R&R2R*g�������?R3g�������?R-i NR�R�g�������?tadmin__bsdi_crypt__vary_roundsg333333�?tadmin__sha512_crypt__max_roundsi@�R�tvary_roundst
max_roundsR�N(sadmin(RTRRoR@R�t
categoriesR�(R?R�Ri((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_33_options�sP	







cC�sKt|j�}|j|j�|j�|j|jdt�|j�dS(stest to_dict() methodR�N(RRBR@RARoRC(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_34_to_dictCscC�s�t|j�}|j�}ts7|j||j�ntj|�}|j|j�|j�|jdd�}|j||jdd��ddl	m
}t|dg�}|j�}|j|d�d	S(
stest to_string() methodRHspassword-securitys	[passlib]s[password-security]i����(tUnsaltedHashR%sM# NOTE: the 'unsalted_test_hash' handler\(s\) are not registered with PasslibN(RRBRsRR@RMRLRAtreplacet!passlib.tests.test_utils_handlersR�Rk(R?RFtdumptctx2totherR�tctx3((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_35_to_stringJsR�icC�s�tjtjtjg}t|dd�}x�|D]�}|jdd|j�}|j|j|�|j�|j|j|dtdt�|�|j	|j|dt�|�|j
|jd|��|j|jd|��q1W|jd�}|j|j|�d�|j
d	|j��}|j|j|�d�|j
d	|j�dd�}|j|j|�d�|jt|j
d	|j�dd
�dS(s-test basic hash/identify/verify functionalityR,ittestR�R�R�tnotestR%tsecretR$N(RR%R$R&RR�R@tidentifyRoR�R�tverifytassertFalsetgenhasht	genconfigRRRu(R?thandlersRvtcryptth((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyt
test_40_basicqs 
%c
C�s�tdddgdddddd	�}|j|j�jd
��|j|jdd�jd��|j|jddd
d�jd��|j|jddd
d�jd��|j|jdddddddd	�d�trN|jdd�}|j|jd
td��jd��|j|jd
td��jd��n|jt	t�j�|jt	t�jdd�|jt	|jdd�|jt
|jddd
d�|jt
|jdd�|jt
|jd
d�dS(stest genconfig() methodR(R%R0R7R8R9itadmin__phpass__identR�s$1$R�s$H$5R�R�s$P$5R�tsaltt.itroundstidents"$P$6........22zGEuacuPOqEpYPDeR0R/R)tfakeiNs........(RR�R�t
startswithR@RRRRRRtRS(R?Rvtc2((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_41_genconfig�s*	"((!
(+cC�sPtdg�}|jd�}x3|jD](\}}|jt|j|||�q(Wtdg�}xE|jD]:\}}|d
kr�qmn|jt|jd||�qmWtdg�}|jt|jdd
�|jtt�jdd�|jt|jd|dd�|jt|jd|dd�|jt|jd|d	d�d
S(stest genhash() methodR$tstubR�R�RR�R�iR�N(	RRtnonstring_vectorsRRRSR�RTRtR�(R?RvRR�Rtconfig((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_42_genhash�s  cC�s�t|j�}|jd�}|j|jd��|j|jd|��|j|jd|��|jt|j	dd�tdg�}x0|j
D]%\}}|jt|j||�q�W|jtt�jd�|jt|jddd	�d
S(stest hash() methodtpasswords$5$rounds=3000$t	passwordxR6i�R$R�R�iN(
Rt
sample_4_dictRR�R�R�R�RRRuRR�RSRt(R?RvRR�R((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_43_hash�scC�sIt|j�}|jdg��*|j|jddddd�d�Wd	QX|jdg��0|j|jdddddd
d�d�Wd	QX|jdg��*|j|jdd
ddd�d�Wd	QX|jdg��*|j|jdd
ddd�d�Wd	QX|jt|jddd�|jt|jddd�d	S(s;test hash() method -- legacy 'scheme' and settings keywordss"passing settings to.*is deprecatedR�R�R0R�R�is"$H$5........De04R5Egz0aq8Tf.1eVhY/NR�R�s"$P$5........De04R5Egz0aq8Tf.1eVhY/R�i�tnacls?$5$rounds=1999$nacl$nmfwJIxqj0csloAAvSER0B8LU0ERCAbhmMug4Twl609i�s?$5$rounds=2001$nacl$8PdeoPL4aXQnJ0woHhqgIw/efyfCKC2WHneOpnvF.31R�R�is........s........(RR�tassertWarningListR@RRRRtRS(R?t
use_16_legacyRv((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_43_hash_legacy�s&



cC�s�dddg}t|dd�}|j|jd�d�|jt|jddt�tdg�}x0|jD]%\}}|jt|j||�qoWt�}|j	|jd�d�|jt
|jddt�|jt|jdd	d
�dS(stest identify() border casesR%R$R&R,is$9$232323123$1287319827trequiredRR�iN(RR@R�RTRRRuRoR�RStassertIsRt(R?R�RvRR((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_44_identify.s	cC�s"dddg}t|dd�}tjjd�}|j|jd|��|j|jd|��|j|jd|dd��|j|jd|dd��|jt|jd|dd�|jt|jd	d
�tdg�}|jd	�}}x3|jD](\}}|jt|j|||�q	W|j	|j|d��tdg�}xE|jD]:\}}|dkr�qgn|jt|jd||�qgW|jtt�jdd�|jt|jd|dd
�|jt|jd|dd�|jt|jd|dd�dS(stest verify() scheme kwdR%R$R&R,iR�R�R�R�s$6$232323123$1287319827R�RR�iR�N(RRR%R�R�RRRuR�RSR�RTRt(R?R�RvR�trefhashR�R((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_45_verifyHs.   c�s2t|j�}|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��g�dtjf�fd��Y}t|g�}|jd	�}}|j|j|��|j�|dfg��2|j|j|d
d��|j�|dfg��2|j|j|d
d��|j�|dfg��2td
g�}x0|j
D]%\}}|jt|j||�q�W|jt
t�jd�|jt
|j|dd�|jt|j|dd�|jt|j|dd�dS(stest 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/2hdFpxA3fAtdummyc�s5eZdZdZed�fd��Zd�ZRS(R�t@c�s�j||f�|dkS(Ntnu(tappend(tclsRR�(tcheck_state(s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytneeds_update�scS�sGddlm}t|t�r1|jd�}nt||�j��S(Ni����(tmd5sutf-8(thashlibR�t
isinstanceR
RORt	hexdigest(R?R�R�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyt_calc_checksum�sN(R�R�R�t_hash_prefixtclassmethodRTR�R�((R�(s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR��s
R�R�tbobR�R$RR�R�iR�N(RR�R�R�R�R�R�RR@RTR�RRRSRt(R?RvR�RFRR�R((R�s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_46_needs_update{s6c
C�sjt|j�}|jd�jd�}|jd�jd�}|jd|�\}}|j|�|j|d�|jd|�\}}|j|�|j|d�|jd|�\}}|j|�|j|j	|�d�|jd|�\}}|j|�|j|d�tdg�}|jd�}}x3|j
D](\}}	|jt|j|||	�qHW|j
|j|d�tdf�tdg�}xE|j
D]:\}}	|dkr�q�n|jt|jd||	�q�W|jtt�jdd�|jt|jd|dd	�|jt|jd|dd
�|jt|jd|dd
�dS(
stest verify_and_update()R$R�R1t	wrongpassR�R�RR�R�iR�N(RR�R�Rtverify_and_updateR�R�RTR�R�R�RRRSR@tFalseRt(
R?Rvth1th2toktnew_hashRR�R�R((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_47_verify_and_update�s:



 " c
C�s�ddlm}m}m}|jd�}|jddd�}|jddd�}t||g�}|j|jt��|j	|j
|jd��d�|j	|jd|��|j|jd|�t
d	f�|jdg��!|jt|jddd�Wd	QX|jt|jd|dd�|jt|jd|dd�t||g�}|j|jtdg��|j	|j
|jd��d�|j	|jd|��|j|jd|�t
d	f�|j	|j
|jddd��d�|j	|jd|dd��|j|jd|dd�t
d	f�|jdg��!|jt|jdd
d�Wd	QX|jt|jd|d
d�|jt|jd|d
d�t||gdd�}	|j|	jtdg��|jt|	jd�|jt|	jd|�|jt|	jd|�|j|	jddd�|�|j	|	jd|dd��|j|	jd|dd�t
d	f�|j|	jd|dd�td	f�|j|	jd|dd�t
|f�d	S(
sLhash(), verify(), and verify_and_update() -- discard unused context keywordsi����(R$R%tpostgres_md5R�R�trootR�R$s"passing settings to.*is deprecatedNtbadkwdR2tauto(tpasslib.hashR$R%RRRR@tcontext_kwdstsetR�R�R�RRoRTR�RRRSR(
R?R$R%Rtdes_hashtpg_root_hasht
pg_admin_hashReRfRh((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_48_context_kwds�sH"""""(("((cC�sGtddgdddddd�}d	}|jdd�}|j|jd�|j|jd�|j|jd�|jtgd
��#|j	dddddd�}WdQX|j|j
d
d�d|�|jg��+|j|j
ddd
d�d|�WdQX|j|j
ddd
d�d|�|j|j
ddd
d�d|�|jtgd
��7|j	dtd�ddddtd�d�}WdQX|j|j
d
d�d|�|jg��+|j|j
ddd
d�d|�WdQX|j|j
ddd
d�d|�|j|j
ddd
d�d|�|j|j
d
d�d|�tj
j}|j	ddd|d>�}|j|j
d
d�d||f�|j	dddd�}|j|j
d
d�d|�|jt|j	dd�|j	dd�|j	dd�|jt|j	dd�tddg�}|jt|j	dddd�|jttdd �|jttdd �|jttd!d �|jttdd �tjj�}|jttdd|�|jttdd|�|jttdd!|�|jttdd|�dS("stest rounds limitsR(R1R5i�R4i�R6i�	s+...........................................ii�NR�R�s$5$rounds=1000$nacl$R�i�s$5$rounds=1999$nacl$s$5$rounds=2000$nacl$i�s$5$rounds=2001$nacl$ge��As$5$rounds=999999999$nacl$i�s$5$rounds=3001$nacl$s$5$rounds=3000$nacl$i�s$5$rounds=2999$nacl$s$5$rounds=2500$nacl$is$5$rounds=%d$nacl$%sR~R*(Rt_get_recordRTR@tmin_desired_roundstmax_desired_roundstdefault_roundsR�RRR�tintRR1RRRutdatetimetnowRS(R?RvtSTUBtcustom_handlerR�tdftbad((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_50_rounds_limitsQsj	 &   &   & c	C�stddgdddddd�}|jt|jd	d
�|jt|jd	d�|jt|jd	d�|jd	d
�}|j|jdd�jd
�|j|ddd�|jd	d�}|j|jdd�jd
�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�dS(stest linear vary roundsR(R1R5i�R4i�R6i�R*i����s-1%s101%is0%ii�i�ids0.1%g����MbP?i�i�s100%g�?N(	RRRRuRR@RRTR�tassert_rounds_range(R?RvR�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_51_linear_vary_rounds�s2	c	C�s�tddgdddddd�}|jt|jd	d
�|jt|jd	d�|jt|jd	d�|jd	d
�}|j|jdd�jd
�|j|ddd�|jd	d�}|j|jdd�jd
�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�|jd	d�}|j|jdd�jd�|j|ddd�dS(stest log2 vary roundsR(tbcrypttbcrypt__min_roundsitbcrypt__max_roundsitbcrypt__default_roundsiR*i����s-1%s101%is0%iiiids1%g{�G�z�?s49%g\��(\�?s50%g�?s100%g�?N(	RRRRuRR@RRTR�R(R?RvR�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_52_log2_vary_rounds�s>	cC�s�|j|�}|jdd!|j}t�}xHtd�D]:}|j|d|�}	|j|	�j}
|j|
�q<W|j	t
|�|d�|j	t|�|d�dS(s2helper to check vary_rounds covers specified rangeiii,R�s"vary_rounds had wrong lower limit:s"vary_rounds had wrong upper limit:N(R�tdefault_salt_charst
max_salt_sizeR
RR�RLR�taddR@tmintmax(R?tcontextR�tlowertupperR�R�tseentiR�tr((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyRs	cC�s�tjdddt�tddg�}|j|jd
�|j|jdd�jd
�|j|jdd�jd
�|j|jdd	�jd
�d
S(sharden_verify -- parsingR:s.*harden_verify.*R�R(R1t
harden_verifytttruetfalseN(R=R>tDeprecationWarningRR@R0RTtusing(R?RF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_harden_verify_parsing-scC�spd}d}tj�}||_td|g�}|j�t|j�\}}|j||d||�dS(s'
        dummy_verify() method
        g�������?g�������?R(tdeltaN(t	DelayHashR5tdelayRtdummy_verifyRtassertAlmostEqual(R?texpectedtaccuracyR�RFtelapsedt_((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_dummy_verify9s	
cC�s�dd�}tddd�}|j||d�tttg�|j||d�tttg�|jdd�|j||d�tttg�|j||d�tttg�|jdd	�|j||d�tttg�|j||d�tttg�td
gdd�}|j||d�tg�|j||d�tg�|jttddd�|jttddd
�dS(s+test deprecated='auto' is handled correctlycS�s,g|j�D]}|j||�j^q
S(N(R(R�R2(RFR�R�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytgetstatePss sha256_crypt,md5_crypt,des_cryptR2R
R�R)R%R�R$R1ssha256_crypt,md5_cryptsauto,md5_cryptsmd5_crypt,autoN(RTRR@RRoRRRRu(R?RARF((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_61_autodeprecateMs"""""""cC�s
ddlm}m}tdg�}tddg�}|jd�}|jd�}|jtd|j�|jtd|j|�|jtd|j|�|j�}|j||j	�|j|�}|j||j	|�|j|�}	|j|	|j	|�|j|j|�|�|j
|j|��d}
|jt|
|j|�|jt|
|j|�|jt|
|j|�|j
|j|��|jt|
|j|�|j
|j|��|j
|j|��|jt|
|jd�|jt|jd
�|j|j|�|�|jt|
|j|�|jt|
|j|�|jt|
|j|�|jt|
|jd�|jt|jd
�|j|j|�|�|jt|
|j|�|jtd	|j|�|j|j|�|�d
S(sdisabled hash supporti����(R%t
unix_disabledR$RCtfoosno disabled hasher presentshash could not be identifiedR1scannot restore original hashN(RR%RCRRtassertRaisesRegexRZtdisableR@tdefault_markerR�t
is_enabledRuR�tenableRRRSRT(R?R%RCRFR�th_refth_otherth_dist	h_dis_refth_dis_othertHASH_NOT_IDENTIFIED((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_disabled_hashesmsd













N((JR�R�tdescriptionPrefixR�R�RR�R�RBR"RCRRNRMRVRWR_R`RYR�RPR\RORQR]RRRDRyRbRERcR�R<RGRURaRjRmRpRxRzR�R�R�R�R�RTR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRRR$RR6R@RBRP(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR#1s�			
	
	

														+		%	L	$	\	%				$	O		!				1	$	1		3	G	:	U	v	&	/				 R8cB�s>eZdZdZejZdZdZe	d�Z
d�ZRS(s-dummy hasher which delays by specified amountt
delay_hashi(is$x$cC�sNtj|j�t|t�r1|jd�}nttjd|�j	��S(Nsutf-8tprefix(
ttimetsleepR9R�R
RORR�tsha1R�(R?R�((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR��s(R�R�t__doc__R�R�tLOWER_HEX_CHARStchecksum_charst
checksum_sizeR9RR�R�(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR8�s	tdummy_2cB�seZdZRS(R[(R�R�R�(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR[�stLazyCryptContextTestcB�s)eZdZd�Zd�Zd�ZRS(RcC�std�|jtd�dS(NR[(tunload_handler_namet
addCleanup(R?((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR<�s
cC�s�|jtd��tdd�ttddg�ddg�}|jtdt��|j|j�d�|j|j	d�j
�|jtdt��dS(stest plain kwdsR[spasslib.tests.test_contextR$R2N(sdummy_2s	des_crypt(R�thas_crypt_handlerRRtiterRoR@R(R�R�R2(R?Rv((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_kwd_constructor�s
!c�s��jtd��tdd�t�fd�}td|dt�}�jtdt���j|j�d��j|j	d�j
��jtdt��dS(NR[spasslib.tests.test_contextc�s/�j|�tdtddg�ddg�S(NR(R[R$R2(R�R�R`(tflag(R?(s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pytonload�s
RcRbR$(sdummy_2s	des_crypt(R�R_RRRRoR@R(R�R�R2(R?RcRv((R?s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyttest_callable_constructor�s
(R�R�RQR<RaRd(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyR\�s		(ARWt
__future__Rtpasslib.utils.compatRtconfigparserRtConfigParserRt	functoolsRtloggingt	getLoggerR�tlogRVR=tpasslibRtpasslib.contextRRtpasslib.excRRt
passlib.utilsR	R
RRR
RRRtpasslib.utils.handlerstutilsR�R�tpasslib.tests.utilsRRRRRRtpasslib.registryRRR_RR]RRWtabspathtdirnamet__file__R`R"R#R�RTR�R8R[R\(((s>/usr/lib/python2.7/site-packages/passlib/tests/test_context.pyt<module>s@.."		�������

Anon7 - 2022
AnonSec Team