def get_nginx_configurator(config_path, config_dir, work_dir, version=(1, 6, 2)):
 backups = os.path.join(work_dir, 'backups')
 with mock.patch('certbot_nginx.configurator.NginxConfigurator.config_test'):
  with mock.patch('certbot_nginx.configurator.util.exe_exists') as mock_exe_exists:
   mock_exe_exists.return_value = True
   config = configurator.NginxConfigurator(config=mock.MagicMock(nginx_server_root=config_path, le_vhost_ext='-le-ssl.conf', config_dir=config_dir, work_dir=work_dir, backup_dir=backups, temp_checkpoint_dir=os.path.join(work_dir, 'temp_checkpoints'), in_progress_dir=os.path.join(backups, 'IN_PROGRESS'), server='https://acme-server.org:443/new', tls_sni_01_port=5001), name='nginx', version=version)
   config.prepare()
 nsconfig = configuration.NamespaceConfig(config.config)
 zope.component.provideUtility(nsconfig)
 return config

def get_nginx_configurator ( config_path , config_dir , work_dir , version = ( 1 , 6 , 2 ) ) : backups = os . path . join ( work_dir , 'backups' ) with mock . patch ( 'certbot_nginx.configurator.NginxConfigurator.config_test' ) : with mock . patch ( 'certbot_nginx.configurator.util.exe_exists' ) as mock_exe_exists : mock_exe_exists . return_value = True config = configurator . NginxConfigurator ( config = mock . MagicMock ( nginx_server_root = config_path , le_vhost_ext = '-le-ssl.conf' , config_dir = config_dir , work_dir = work_dir , backup_dir = backups , temp_checkpoint_dir = os . path . join ( work_dir , 'temp_checkpoints' ) , in_progress_dir = os . path . join ( backups , 'IN_PROGRESS' ) , server = 'https://acme-server.org:443/new' , tls_sni_01_port = 5001 ) , name = 'nginx' , version = version ) config . prepare ( ) nsconfig = configuration . NamespaceConfig ( config . config ) zope . component . provideUtility ( nsconfig ) return config
create an nginx configurator with the specified options .