Exemple #1
0
    def test_webroot_params_conservation(self, mock_set_by_cli):
        # For more details about why this test is important, see:
        # certbot.plugins.webroot_test::WebrootActionTest::test_webroot_map_partial_without_perform
        from certbot import renewal
        mock_set_by_cli.return_value = False

        renewalparams = {
            'webroot_map': {
                'test.example.com': '/var/www/test'
            },
            'webroot_path': ['/var/www/test', '/var/www/other'],
        }
        renewal._restore_webroot_config(self.config, renewalparams)  # pylint: disable=protected-access
        self.assertEqual(self.config.webroot_map,
                         {'test.example.com': '/var/www/test'})
        self.assertEqual(self.config.webroot_path,
                         ['/var/www/test', '/var/www/other'])

        renewalparams = {
            'webroot_map': {},
            'webroot_path': '/var/www/test',
        }
        renewal._restore_webroot_config(self.config, renewalparams)  # pylint: disable=protected-access
        self.assertEqual(self.config.webroot_map, {})
        self.assertEqual(self.config.webroot_path, ['/var/www/test'])
Exemple #2
0
 def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
     mock_set_by_cli.return_value = False
     rc_path = self._make_test_renewal_conf('sample-renewal-ancient.conf')
     args = mock.MagicMock(account=None, email=None, webroot_path=None)
     config = configuration.NamespaceConfig(args)
     lineage = storage.RenewableCert(
         rc_path, configuration.RenewerConfiguration(config))
     renewalparams = lineage.configuration["renewalparams"]
     # pylint: disable=protected-access
     renewal._restore_webroot_config(config, renewalparams)
     self.assertEqual(config.webroot_path, ["/var/www/"])
Exemple #3
0
 def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
     mock_set_by_cli.return_value = False
     rc_path = self._make_test_renewal_conf('sample-renewal-ancient.conf')
     args = mock.MagicMock(account=None, email=None, webroot_path=None)
     config = configuration.NamespaceConfig(args)
     lineage = storage.RenewableCert(rc_path,
         configuration.RenewerConfiguration(config))
     renewalparams = lineage.configuration["renewalparams"]
     # pylint: disable=protected-access
     renewal._restore_webroot_config(config, renewalparams)
     self.assertEqual(config.webroot_path, ["/var/www/"])
Exemple #4
0
 def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
     mock_set_by_cli.return_value = False
     rc_path = util.make_lineage(self, 'sample-renewal-ancient.conf')
     args = mock.MagicMock(account=None, email=None, webroot_path=None)
     config = configuration.NamespaceConfig(args)
     lineage = storage.RenewableCert(rc_path, config)
     renewalparams = lineage.configuration['renewalparams']
     # pylint: disable=protected-access
     from certbot import renewal
     renewal._restore_webroot_config(config, renewalparams)
     self.assertEqual(config.webroot_path, ['/var/www/'])
Exemple #5
0
 def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
     mock_set_by_cli.return_value = False
     rc_path = util.make_lineage(self, 'sample-renewal-ancient.conf')
     args = mock.MagicMock(account=None, config_dir=self.config_dir,
                           logs_dir="logs", work_dir="work",
                           email=None, webroot_path=None)
     config = configuration.NamespaceConfig(args)
     lineage = storage.RenewableCert(rc_path, config)
     renewalparams = lineage.configuration['renewalparams']
     # pylint: disable=protected-access
     from certbot import renewal
     renewal._restore_webroot_config(config, renewalparams)
     self.assertEqual(config.webroot_path, ['/var/www/'])