def test_renew_with_hook_scripts(context): """Test certificate renewal with script hooks.""" certname = context.get_domain('renew') context.certbot(['-d', certname]) assert_cert_count_for_lineage(context.config_dir, certname, 1) misc.generate_test_file_hooks(context.config_dir, context.hook_probe) context.certbot(['renew']) assert_cert_count_for_lineage(context.config_dir, certname, 2) assert_hook_execution(context.hook_probe, 'deploy')
def test_renew_ignoring_directory_hooks(context): """Test hooks are ignored during renewal with relevant CLI flag.""" certname = context.get_domain('renew') context.certbot(['-d', certname]) assert_cert_count_for_lineage(context.config_dir, certname, 1) misc.generate_test_file_hooks(context.config_dir, context.hook_probe) context.certbot(['renew', '--no-directory-hooks']) assert_cert_count_for_lineage(context.config_dir, certname, 2) with pytest.raises(AssertionError): assert_hook_execution(context.hook_probe, 'deploy')
def test_renew_empty_hook_scripts(context): """Test proper renew with empty hook scripts.""" certname = context.get_domain('renew') context.certbot(['-d', certname]) assert_cert_count_for_lineage(context.config_dir, certname, 1) misc.generate_test_file_hooks(context.config_dir, context.hook_probe) for hook_dir in misc.list_renewal_hooks_dirs(context.config_dir): shutil.rmtree(hook_dir) os.makedirs(join(hook_dir, 'dir')) open(join(hook_dir, 'file'), 'w').close() context.certbot(['renew']) assert_cert_count_for_lineage(context.config_dir, certname, 2)