コード例 #1
0
 def test_configure_validation_success(self, mock_open):
     with mock.patch('os.path.isfile', return_value=True):
         settings = Settings()
         settings.configure()
         self.assertTrue(settings.configured)
         self.assertEqual(settings.server.hostname, 'example.com')
         self.assertEqual(settings.server.ssh_password, '1234')
コード例 #2
0
 def test_configure_with_file_validation_success(self, mock_open):
     with mock.patch('os.path.isfile', return_value=True):
         settings = Settings()
         settings.configure(settings_path='robottelo.properties')
         assert settings.configured
         assert settings.server.hostname == 'example.com'
         assert settings.server.ssh_password == '1234'
コード例 #3
0
 def test_configure_validation_success(self, mock_open):
     with mock.patch('os.path.isfile', return_value=True):
         settings = Settings()
         settings.configure()
         self.assertTrue(settings.configured)
         self.assertEqual(settings.server.hostname, 'example.com')
         self.assertEqual(settings.server.ssh_password, '1234')
コード例 #4
0
 def test_configure_validation_error(self, mock_open):
     settings = Settings()
     with pytest.raises(ImproperlyConfigured):
         settings.configure()
コード例 #5
0
 def test_configure_validation_error(self, mock_open):
     settings = Settings()
     with self.assertRaises(ImproperlyConfigured):
         settings.configure()
コード例 #6
0
from dynaconf import LazySettings
from dynaconf.validator import ValidationError

from .validators import validators as dynaconf_validators
from robottelo.config.base import Settings as LegacySettings
from robottelo.config.facade import SettingsFacade
from robottelo.config.facade import SettingsNodeWrapper
from robottelo.errors import ImproperlyConfigured
from robottelo.logging import config_logger as logger
from robottelo.logging import robottelo_root_dir

if not os.getenv('ROBOTTELO_DIR'):
    # dynaconf robottelo file uses ROBOTELLO_DIR for screenshots
    os.environ['ROBOTTELO_DIR'] = str(robottelo_root_dir)

legacy_settings = LegacySettings()

dynaconf_settings = LazySettings(
    envvar_prefix="ROBOTTELO",
    core_loaders=["YAML"],
    settings_file="settings.yaml",
    preload=["conf/*.yaml"],
    includes=["settings.local.yaml", ".secrets.yaml", ".secrets_*.yaml"],
    envless_mode=True,
    lowercase_read=True,
)
dynaconf_settings.validators.register(**dynaconf_validators)

try:
    legacy_settings.configure()
except ImproperlyConfigured:
コード例 #7
0
ファイル: __init__.py プロジェクト: vsedmik/robottelo
from robottelo.config.base import Settings

#: A :class:`Settings` object.
settings = Settings()