def setUp( self, test_dir="debian_apache_2_4/multiple_vhosts", config_root="debian_apache_2_4/multiple_vhosts/apache2", vhost_root="debian_apache_2_4/multiple_vhosts/apache2/sites-available" ): # pylint: disable=arguments-differ self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( test_dir=test_dir, pkg=__name__) self.config_path = os.path.join(self.temp_dir, config_root) self.vhost_path = os.path.join(self.temp_dir, vhost_root) self.rsa512jwk = jose.JWKRSA.load( test_util.load_vector("rsa512_key.pem")) self.config = get_apache_configurator(self.config_path, vhost_root, self.config_dir, self.work_dir) # Make sure all vhosts in sites-enabled are symlinks (Python packaging # does not preserve symlinks) sites_enabled = os.path.join(self.config_path, "sites-enabled") if not os.path.exists(sites_enabled): return for vhost_basename in os.listdir(sites_enabled): # Keep the one non-symlink test vhost in place if vhost_basename == "non-symlink.conf": continue vhost = os.path.join(sites_enabled, vhost_basename) if not os.path.islink(vhost): # pragma: no cover os.remove(vhost) target = os.path.join(os.path.pardir, "sites-available", vhost_basename) os.symlink(target, vhost)
def setUp(self): super(KongTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( test_dir="test_kong", pkg="certbot_kong.tests") self.config_path = os.path.join(self.temp_dir, "test_kong") self.server = MockHttpServer(handler=MockKongAdminHandler) self.server.start() self.configurator = get_kong_configurator(self.server.url, self.config_path, self.config_dir, self.work_dir) self.cert_path = os.path.join(THIS_DIR, "testdata/cert_file.txt") self.key_path = os.path.join(THIS_DIR, "testdata/key_file.txt") self.chain_path = os.path.join(THIS_DIR, "testdata/chain_file.txt") self.fullchain_path = os.path.join(THIS_DIR, "testdata/fullchain_file.txt") self.fullchain_path = os.path.join(THIS_DIR, "testdata/fullchain_file.txt") with open(self.key_path, 'r') as file: self.key_str = file.read() with open(self.fullchain_path, 'r') as file: self.fullchain_str = file.read()
def setUp(self, test_dir="debian_apache_2_4/multiple_vhosts", config_root="debian_apache_2_4/multiple_vhosts/apache2", vhost_root="debian_apache_2_4/multiple_vhosts/apache2/sites-available"): # pylint: disable=arguments-differ super(ApacheTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( test_dir=test_dir, pkg="certbot_apache.tests") self.config_path = os.path.join(self.temp_dir, config_root) self.vhost_path = os.path.join(self.temp_dir, vhost_root) self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector( "rsa512_key.pem")) self.config = get_apache_configurator(self.config_path, vhost_root, self.config_dir, self.work_dir) # Make sure all vhosts in sites-enabled are symlinks (Python packaging # does not preserve symlinks) sites_enabled = os.path.join(self.config_path, "sites-enabled") if not os.path.exists(sites_enabled): return for vhost_basename in os.listdir(sites_enabled): # Keep the one non-symlink test vhost in place if vhost_basename == "non-symlink.conf": continue vhost = os.path.join(sites_enabled, vhost_basename) if not os.path.islink(vhost): # pragma: no cover os.remove(vhost) target = os.path.join( os.path.pardir, "sites-available", vhost_basename) os.symlink(target, vhost)
def setUp( self, test_dir="debian_apache_2_4/multiple_vhosts", config_root="debian_apache_2_4/multiple_vhosts/apache2", vhost_root="debian_apache_2_4/multiple_vhosts/apache2/sites-available" ): # pylint: disable=arguments-differ super(ApacheTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( test_dir=test_dir, pkg="certbot_apache.tests") self.ssl_options = common.setup_ssl_options( self.config_dir, constants.os_constant("MOD_SSL_CONF_SRC"), constants.MOD_SSL_CONF_DEST) self.config_path = os.path.join(self.temp_dir, config_root) self.vhost_path = os.path.join(self.temp_dir, vhost_root) self.rsa512jwk = jose.JWKRSA.load( test_util.load_vector("rsa512_key.pem")) # Make sure all vhosts in sites-enabled are symlinks (Python packaging # does not preserve symlinks) sites_enabled = os.path.join(self.config_path, "sites-enabled") if not os.path.exists(sites_enabled): return for vhost_basename in os.listdir(sites_enabled): vhost = os.path.join(sites_enabled, vhost_basename) if not os.path.islink(vhost): # pragma: no cover os.remove(vhost) target = os.path.join(os.path.pardir, "sites-available", vhost_basename) os.symlink(target, vhost)
def setUp(self, test_dir="debian_apache_2_4/multiple_vhosts", config_root="debian_apache_2_4/multiple_vhosts/apache2", vhost_root="debian_apache_2_4/multiple_vhosts/apache2/sites-available"): # pylint: disable=arguments-differ super(ApacheTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( test_dir=test_dir, pkg="certbot_apache.tests") self.ssl_options = common.setup_ssl_options( self.config_dir, constants.os_constant("MOD_SSL_CONF_SRC"), constants.MOD_SSL_CONF_DEST) self.config_path = os.path.join(self.temp_dir, config_root) self.vhost_path = os.path.join(self.temp_dir, vhost_root) self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector( "rsa512_key.pem")) # Make sure all vhosts in sites-enabled are symlinks (Python packaging # does not preserve symlinks) sites_enabled = os.path.join(self.config_path, "sites-enabled") if not os.path.exists(sites_enabled): return for vhost_basename in os.listdir(sites_enabled): vhost = os.path.join(sites_enabled, vhost_basename) if not os.path.islink(vhost): # pragma: no cover os.remove(vhost) target = os.path.join( os.path.pardir, "sites-available", vhost_basename) os.symlink(target, vhost)
def setUp(self): super(NginxTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( "etc_nginx", "certbot_nginx.tests") self.logs_dir = tempfile.mkdtemp('logs') self.config_path = os.path.join(self.temp_dir, "etc_nginx") self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector( "rsa512_key.pem"))
def setUp(self): super(NginxTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup("etc_nginx", "certbot_nginx.tests") self.ssl_options = common.setup_ssl_options( self.config_dir, constants.MOD_SSL_CONF_SRC, constants.MOD_SSL_CONF_DEST ) self.config_path = os.path.join(self.temp_dir, "etc_nginx") self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
def setUp(self): super(NginxTest, self).setUp() self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( "etc_nginx", "certbot_nginx.tests") self.ssl_options = common.setup_ssl_options( self.config_dir, constants.MOD_SSL_CONF_SRC, constants.MOD_SSL_CONF_DEST) self.config_path = os.path.join(self.temp_dir, "etc_nginx") self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector( "rsa512_key.pem"))
def setUp(self): super().setUp() self.configuration = self.config self.config = None self.temp_dir, self.config_dir, self.work_dir = common.dir_setup( "etc_nginx", __name__) self.logs_dir = tempfile.mkdtemp('logs') self.config_path = os.path.join(self.temp_dir, "etc_nginx") self.rsa512jwk = jose.JWKRSA.load( test_util.load_vector("rsa512_key.pem"))
def setUp(self): self.test_dir = "installer" self.temp_dir, config_dir, work_dir = common.dir_setup( test_dir=self.test_dir, pkg="certbot_haproxy.tests") backups = os.path.join(work_dir, "backups") mock_le_config = mock.MagicMock( temp_checkpoint_dir=os.path.join(work_dir, "temp_checkpoints"), in_progress_dir=os.path.join(backups, "IN_PROGRESS"), work_dir=work_dir, config_dir=config_dir, temp_dir=self.temp_dir, backup_dir=backups, haproxy_config=os.path.join(self.temp_dir, self.test_dir, "haproxy.cfg"), haproxy_crt_dir=os.path.join(self.temp_dir, self.test_dir, "certs"), haproxy_ca_common_name=u'h2ppy h2cker fake CA', no_fall_back_cert=False, ) self.installer = HAProxyInstaller(config=mock_le_config, name="installer") self.installer.prepare()