o
    5ÎhB  ã                   @   s^   d Z ddlmZ ddlZe e¡ZddlmZm	Z
 ddlmZ ddlmZ G dd„ deƒZdS )	ztest passlib.hostsé    )Úwith_statementN)ÚhostsÚhash)Úunix_crypt_schemes)ÚTestCasec                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )Ú	HostsTestz0perform general tests to make sure contexts workc                 C   s2   dD ]}|   | |¡d¡ |  | d|¡¡ qd S )N)Ú ú!Ú*z#!$1$TXl/FX/U$BZge.lr.ux6ekjEjxmzwz0Úunix_disabledÚtest)ÚassertEqualÚidentifyÚassertFalseÚverify©ÚselfÚctxr   © r   úl/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/passlib/tests/test_hosts.pyÚcheck_unix_disabled   s   ùzHostsTest.check_unix_disabledc                 C   s0   t j}dD ]}|  | d|¡¡ q|  |¡ d S )N)úw$6$rounds=41128$VoQLvDjkaZ6L6BIE$4pt.1Ll1XdDYduEwEYPCMOBiR6W6znsyUEoNlcVXpv2gKKIbQolgmTGe6uEEVJ7azUxuc8Tf7zV9SD2z7Ij751úL$5$rounds=31817$iZGmlyBQ99JSB5n6$p4E.pdPBWx19OajgjLRiOW0itGnyxDGgMlDcOsfaI17ú"$1$TXl/FX/U$BZge.lr.ux6ekjEjxmzwz0úkAJJz.Rwp0A/Ir   )r   Úlinux_contextÚ
assertTruer   r   r   r   r   r   Útest_linux_context%   s   zHostsTest.test_linux_contextc                 C   st   t jt jt jfD ]/}dD ]}|  | d|¡¡ qd}tj ¡ r)|  | d|¡¡ n	|  	| 
|¡d¡ |  |¡ qd S )N)r   r   r   z<$2a$04$yjDgE74RJkeqC0/1NheSSOrvKeu9IbKDpcQf/Ox3qsrRS/Kw42qISÚbcrypt)r   Úfreebsd_contextÚopenbsd_contextÚnetbsd_contextr   r   Úhashmodr   Úhas_backendr   r   r   )r   r   r   Úh1r   r   r   Útest_bsd_contexts2   s   ý
ñzHostsTest.test_bsd_contextsc                 C   s    t tdd ƒ}|s|  d¡S t| ¡ ƒ}|  |d¡ |  d|v ¡ | d¡ |  |d¡ |  ttƒ 	|¡¡ |  
|¡ dD ]\}}||v rM|  | d|¡¡ q<d S )NÚhost_contextz+host_context not available on this platformzBappears to be unix system, but no known schemes supported by cryptr   z*should have schemes beside fallback scheme))Úsha512_cryptr   )Úsha256_cryptr   )Ú	md5_cryptr   )Ú	des_cryptr   r   )Úgetattrr   ÚskipTestÚlistÚschemesr   ÚremoveÚsetr   Ú
issupersetr   r   )r   r   r.   Úschemer   r   r   r   Útest_host_contextD   s   


€÷zHostsTest.test_host_contextN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r%   r3   r   r   r   r   r      s    
r   )r7   Ú
__future__r   ÚloggingÚ	getLoggerr4   ÚlogÚpasslibr   r   r"   Úpasslib.utilsr   Úpasslib.tests.utilsr   r   r   r   r   r   Ú<module>   s    