a }|g@sdZddlZddlmZddlZddlmZddlmZddl m Z ddl m Z ddl m ZGd d d ejZed kreeejd degdS) z Tests for certbot.configuration.N)mock)errors) constants)misc)os)utilcseZdZdZfddZddZddZdd Ze d d d Z d dZ e d ddZ ddZ ddZddZddZddZddZZS)NamespaceConfigTestz0Tests for certbot.configuration.NamespaceConfig.cs.td|j_d|j_d|j_d|j_dS)Nbarzhttps://acme-server.org:443/newi)supersetUpconfigfooserver https_port http01_portself __class__N/usr/lib/python3.9/site-packages/certbot/_internal/tests/configuration_test.pyr s  zNamespaceConfigTest.setUpcCsPd|j_ddlm}ttj||jjWdn1sB0YdS)Nr rNamespaceConfig) r rcertbot.configurationrpytestraisesrError namespace)rrrrrtest_init_same_portss z(NamespaceConfigTest.test_init_same_portscCsdSNrrrrrtest_proxy_getattrsz&NamespaceConfigTest.test_proxy_getattrcCs d|j_dS)NzBhttp://user:pass@acme.server:443/p/a/t/h;parameters?query#fragment)r rrrrrtest_server_path"sz$NamespaceConfigTest.test_server_pathzcertbot.configuration.constantscCs,d|_d|_d|_d|_d|_td}dS)NZaccZbackupsz../pkeystzacc/acme-server.org:443/new)Z ACCOUNTS_DIRZ BACKUP_DIRZIN_PROGRESS_DIRZKEY_DIRZTEMP_CHECKPOINT_DIRrZ.underscores_for_unsupported_characters_in_path)rmock_constantsZref_pathrrrtest_dynamic_dirs+sz%NamespaceConfigTest.test_dynamic_dirscCsPddlm}d}d}d}d}tjgdd}||_||_||_||_||}dS) Nrrrr bazz mock.server config_dirwork_dirlogs_dirrrdomainsrspec)rrr MagicMockr)r*r+r)rr config_base work_base logs_basermock_namespacer rrrtest_absolute_paths?s z'NamespaceConfigTest.test_absolute_pathscCsd|_d|_d|_dS)NalZrenewal_configs)Z ARCHIVE_DIRZLIVE_DIRZRENEWAL_CONFIGS_DIR)rr%rrrtest_renewal_dynamic_dirs_sz-NamespaceConfigTest.test_renewal_dynamic_dirscCsFddlm}d}d}d}tjgdd}||_||_||_||}dS)Nrrrr r'r(r-)rrrr/r)r*r+)rrr0r1r2r3r rrrtest_renewal_absolute_pathsjs z/NamespaceConfigTest.test_renewal_absolute_pathscCsd|j_d|jj_dS)N*i9)r rrr rrrrtest_get_and_set_attr~s z)NamespaceConfigTest.test_get_and_set_attrcCsdSr rrrrrtest_hook_directoriess z)NamespaceConfigTest.test_hook_directoriescCs d|j_dS)Nza value)r Z somethingrrrr"test_set_by_user_runtime_overridessz6NamespaceConfigTest.test_set_by_user_runtime_overridescCsZddlm}||jj}tt|dWdn1sB0Y|idS)NrrZwhatever) rrr rrr RuntimeErrorZ set_by_userZset_argument_sources)rrr rrrtest_set_by_user_exceptions    ( z.NamespaceConfigTest.test_set_by_user_exceptioncCs|jjddS)Nz example.org)r r,appendrrrrtest_set_by_user_mutablessz-NamespaceConfigTest.test_set_by_user_mutables)__name__ __module__ __qualname____doc__r rr!r"rZpatchr&r4r7r8r:r;r<r>r@ __classcell__rrrrrs       r__main__)rDsysZunittestrrZcertbotrZcertbot._internalrZcertbot.compatrrZ certbot.testsrZ test_utilZConfigTestCaserrAexitmainargv__file__rrrrs