def test_certonly_webroot(context: IntegrationTestsContext) -> None: """Test the certonly verb with webroot plugin""" with misc.create_http_server(context.http_01_port) as webroot: certname = context.get_domain('webroot') context.certbot(['certonly', '-a', 'webroot', '--webroot-path', webroot, '-d', certname]) assert_cert_count_for_lineage(context.config_dir, certname, 1)
def test_http_01(context: IntegrationTestsContext) -> None: """Test the HTTP-01 challenge using standalone plugin.""" # We start a server listening on the port for the # TLS-SNI challenge to prevent regressions in #3601. with misc.create_http_server(context.tls_alpn_01_port): certname = context.get_domain('le2') context.certbot([ '--domains', certname, '--preferred-challenges', 'http-01', 'run', '--cert-name', certname, '--pre-hook', misc.echo('wtf_pre', context.hook_probe), '--post-hook', misc.echo('wtf_post', context.hook_probe), '--deploy-hook', misc.echo('deploy', context.hook_probe), ]) assert_hook_execution(context.hook_probe, 'deploy') assert_saved_renew_hook(context.config_dir, certname) assert_saved_lineage_option(context.config_dir, certname, 'key_type', 'rsa')
def test_manual_http_auth(context): """Test the HTTP-01 challenge using manual plugin.""" with misc.create_http_server(context.http_01_port) as webroot,\ misc.manual_http_hooks(webroot, context.http_01_port) as scripts: certname = context.get_domain() context.certbot([ 'certonly', '-a', 'manual', '-d', certname, '--cert-name', certname, '--manual-auth-hook', scripts[0], '--manual-cleanup-hook', scripts[1], '--pre-hook', misc.echo('wtf_pre', context.hook_probe), '--post-hook', misc.echo('wtf_post', context.hook_probe), '--renew-hook', misc.echo('renew', context.hook_probe), ]) with pytest.raises(AssertionError): assert_hook_execution(context.hook_probe, 'renew') assert_saved_renew_hook(context.config_dir, certname)
def test_http_01(context): """Test the HTTP-01 challenge using standalone plugin.""" # We start a server listening on the port for the # TLS-SNI challenge to prevent regressions in #3601. with misc.create_http_server(context.tls_alpn_01_port): certname = context.get_domain('le2') context.certbot([ '--domains', certname, '--preferred-challenges', 'http-01', 'run', '--cert-name', certname, '--pre-hook', 'echo wtf.pre >> "{0}"'.format(context.hook_probe), '--post-hook', 'echo wtf.post >> "{0}"'.format(context.hook_probe), '--deploy-hook', 'echo deploy >> "{0}"'.format(context.hook_probe) ]) assert_hook_execution(context.hook_probe, 'deploy') assert_saved_renew_hook(context.config_dir, certname)
def test_manual_http_auth(context): """Test the HTTP-01 challenge using manual plugin.""" with misc.create_http_server(context.http_01_port) as webroot,\ misc.manual_http_hooks(webroot, context.http_01_port) as scripts: certname = context.get_domain() context.certbot([ 'certonly', '-a', 'manual', '-d', certname, '--cert-name', certname, '--manual-auth-hook', scripts[0], '--manual-cleanup-hook', scripts[1], '--pre-hook', 'echo wtf.pre >> "{0}"'.format(context.hook_probe), '--post-hook', 'echo wtf.post >> "{0}"'.format(context.hook_probe), '--deploy-hook', 'echo deploy >> "{0}"'.format(context.hook_probe) ]) assert_hook_execution(context.hook_probe, 'deploy') assert_save_renew_hook(context.config_dir, certname)