U
    ]7                     @   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challZurierrorZdomainZchallb)certbot.errorsr   setr   DNSr   ChallengeBodyr   DNS01Errorr   )selfr    r   ;/usr/lib/python3/dist-packages/certbot/tests/errors_test.pysetUp   s      zFailedChallengesTest.setUpc                 C   s   |  t| jd d S )N9Failed 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   Zsocket_errorZ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   