a }|ägJ! ã @ s d Z ddlZddlZddlZddlZddlmZ ddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZ ddlmZ ddlm Z G d d „ d ejejƒZG dd„ dejƒZG d d„ dejƒZG dd„ dejƒZedkre e ejdd… eg ¡¡ dS )z%Tests for certbot.plugins.dns_common.é N)Úmock)Úerrors)Úutil)Úos)Ú dns_common)Údns_test_commonc s´ e Zd ZG dd„ dejƒZG dd„ dƒZ‡ fdd„Ze ¡ dd„ ƒZ d d „ Ze ¡ dd„ ƒZe ¡ d d„ ƒZ e ¡ dd„ ƒZe ¡ dd„ ƒZdd„ Ze ¡ dd„ ƒZdd„ Z‡ ZS )ÚDNSAuthenticatorTestc @ s, e Zd Ze ¡ Ze ¡ Ze ¡ Zdd„ ZdS )z*DNSAuthenticatorTest._FakeDNSAuthenticatorc C s dS )Nz!A fake authenticator for testing.© ©Úselfr r úS/usr/lib/python3.9/site-packages/certbot/_internal/tests/plugins/dns_common_test.pyÚ more_info s z4DNSAuthenticatorTest._FakeDNSAuthenticator.more_infoN) Ú__name__Ú __module__Ú__qualname__r Ú MagicMockZ_setup_credentialsÚ_performÚ_cleanupr r r r r Ú_FakeDNSAuthenticator s r c @ s e Zd ZdZdZdZdZdS )z DNSAuthenticatorTest._FakeConfigr é N)r r r Zfake_propagation_secondsZfake_config_keyÚfake_other_keyÚfake_file_pathr r r r Ú_FakeConfig s r c s( t ƒ ¡ t ¡ | _t | jd¡| _d S )NZfake)ÚsuperÚsetUpr r Úconfigr Úauthr ©Ú __class__r r r % s zDNSAuthenticatorTest.setUpc C s, | j | jg¡ | j j tjtjtj¡ d S ©N) r ZperformÚachallr Úassert_called_once_withr ÚDOMAINr ÚANY)r Zunused_mock_get_utilityr r r Útest_perform, s z!DNSAuthenticatorTest.test_performc C s4 d| j _| j | jg¡ | j j tjtj tj ¡ d S )NT) r Z_attempt_cleanupZcleanupr r r! r r" r r# r r r r Útest_cleanup2 s z!DNSAuthenticatorTest.test_cleanupc C sB |ƒ }t jdft jdff|j_| j dd¡ | jjjdks>J ‚d S )NÚ ÚvalueÚ other_key)Údisplay_utilÚOKÚinputÚside_effectr Ú _configurer r ©r Úmock_get_utilityÚmock_displayr r r Útest_prompt9 s ÿz DNSAuthenticatorTest.test_promptc C sT |ƒ }t jdff|j_t tj¡ | j dd¡ W d ƒ n1 sF0 Y d S )NÚcr( r&