|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /lib/python3/dist-packages/certbot/tests/__pycache__/ |
Upload File : |
U
�]E � @ sB d Z ddlZddlZddlZG dd� dej�Zedkr>e�� dS )zTests for certbot.notify.� Nc @ sZ e Zd ZdZe�d�dd� �Ze�d�e�d�dd� ��Ze�d�e�d�dd � ��Zd
S )�NotifyTestszTests for the notifier.zcertbot.notify.smtplib.LMTPc C sP ddl m} t�� }||_| �|ddd�� | �|jjd� | �|j jd� d S )Nr ��notify�Goose�auntrhody@example.com�The old grey goose is dead.� )
�certbot.notifyr �mock� MagicMock�return_value�
assertTrue�assertEqualZconnect�
call_count�sendmail)�self� mock_lmtpr �lmtp_obj� r �;/usr/lib/python3/dist-packages/certbot/tests/notify_test.py�test_smtp_success s
�zNotifyTests.test_smtp_successzcertbot.notify.subprocess.Popenc C sl ddl m} t�� }||_t�d�|j_t�� }||_| � |ddd�� | �
|jjd� | �
|jjd� d S )Nr r � r r r r )
r r r
r r �socket�errorr �side_effectr
r r �communicate�r Z
mock_popenr r r �procr r r �test_smtp_failure s
�zNotifyTests.test_smtp_failurec C sx ddl m} t�� }||_t�d�|j_t�� }||_t d�|j
_| �|ddd�� | �|jj
d� | �|j
j
d� d S ) Nr r r z.What we have here is a failure to communicate.r r r r )r r r
r r r r r r �OSErrorr ZassertFalser r r r r r �test_everything_fails# s
�z!NotifyTests.test_everything_failsN) �__name__�
__module__�__qualname__�__doc__r
Zpatchr r r r r r r r s
r �__main__)r$ r Zunittestr
ZTestCaser r! �mainr r r r �<module> s +