U
    ÓZj7  ã                   @   sp   d Z ddlZddlZddlmZ ddlmZ ddlmZ G dd„ dej	ƒZ
G dd	„ d	ej	ƒZed
krle ¡  dS )zTests for certbot.errors.é    N)Úmessages)Úachallenges)Ú	acme_utilc                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚFailedChallengesTestz*Tests for certbot.errors.FailedChallenges.c                 C   sB   ddl m} |ttjdtjtjd tj	ddd�d�d�gƒƒ| _
d S )	Nr   ©ÚFailedChallengesúexample.comÚtlsÚdetail©Útypr
   ©ZchallÚuriÚerror©ÚdomainZchallb)Úcertbot.errorsr   Úsetr   ÚDNSr   ÚChallengeBodyr   ÚDNS01ÚErrorr   )Úselfr   © r   ú\/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/site-packages/certbot/tests/errors_test.pyÚsetUp   s      þÿzFailedChallengesTest.setUpc                 C   s   |   t| jƒ d¡¡ d S )Nú9Failed authorization procedure. example.com (dns-01): tls©Ú
assertTrueÚstrr   Ú
startswith©r   r   r   r   Útest_str   s    ÿzFailedChallengesTest.test_strc                 C   sX   ddl m} d}|ttjdtjtjd tj	d|d�d�d�gƒƒ}|  
t|ƒ d	¡¡ d S )
Nr   r   u
   Ø¹Ø¯Ø§Ù„Ø©r   r	   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r    )r   r   Zarabic_detailZarabic_errorr   r   r   Útest_unicode   s      þÿÿz!FailedChallengesTest.test_unicodeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r"   r#   r   r   r   r   r      s   r   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚStandaloneBindErrorTestz-Tests for certbot.errors.StandaloneBindError.c                 C   s    ddl m} |tjjdƒ| _d S )Nr   )ÚStandaloneBindErroréÒ  )r   r)   ÚmockÚsentinelr   )r   r)   r   r   r   r   )   s    zStandaloneBindErrorTest.setUpc                 C   s(   |   tjj| jj¡ |   d| jj¡ d S )Nr*   )ZassertEqualr+   r,   r   Úsocket_errorÚportr!   r   r   r   Útest_instance_args-   s    z*StandaloneBindErrorTest.test_instance_argsc                 C   s   |   t| jƒ d¡¡ d S )NzProblem binding to port 1234: r   r!   r   r   r   r"   1   s    ÿz StandaloneBindErrorTest.test_strN)r$   r%   r&   r'   r   r/   r"   r   r   r   r   r(   &   s   r(   Ú__main__)r'   Zunittestr+   Zacmer   Zcertbotr   Zcertbot.testsr   ZTestCaser   r(   r$   Úmainr   r   r   r   Ú<module>   s   