Esempio n. 1
0
def _get_config_manager():
    required_config = Namespace()

    required_config.search_default_date_range = 7
    required_config.search_maximum_date_range = 365

    config_manager = ConfigurationManager([required_config],
                                          app_name='testapp',
                                          app_version='1.0',
                                          app_description='app description',
                                          argv_source=[])

    return config_manager
Esempio n. 2
0
def _get_config_manager():
    required_config = Namespace()

    webapi = Namespace()
    webapi.search_default_date_range = 7
    webapi.search_maximum_date_range = 365

    required_config.webapi = webapi

    config_manager = ConfigurationManager(
        [required_config], app_name="testapp", app_version="1.0", app_description="app description", argv_source=[]
    )

    return config_manager
Esempio n. 3
0
def _get_config_manager():
    required_config = Namespace()

    required_config.search_default_date_range = 7
    required_config.search_maximum_date_range = 365

    config_manager = ConfigurationManager(
        [required_config],
        app_name='testapp',
        app_version='1.0',
        app_description='app description',
        argv_source=[]
    )

    return config_manager
Esempio n. 4
0
def _get_config_manager():
    required_config = Namespace()

    webapi = Namespace()
    webapi.search_default_date_range = 7

    required_config.webapi = webapi

    config_manager = ConfigurationManager(
        [required_config],
        app_name='testapp',
        app_version='1.0',
        app_description='app description',
    )

    return config_manager
Esempio n. 5
0
def _get_config_manager():
    required_config = Namespace()

    webapi = Namespace()
    webapi.search_default_date_range = 7

    required_config.webapi = webapi

    config_manager = ConfigurationManager(
        [required_config],
        app_name='testapp',
        app_version='1.0',
        app_description='app description',
    )

    return config_manager
Esempio n. 6
0
def _get_config_manager(config, es_index=None):
    if not es_index:
        es_index = config.elasticsearch_index

    mock_logging = mock.Mock()

    required_config = \
        crashstorage.ElasticSearchCrashStorage.get_required_config()
    required_config.add_option('logger', default=mock_logging)

    webapi = Namespace()
    webapi.elasticsearch_index = es_index
    webapi.timeout = 2
    webapi.search_default_date_range = 7

    for opt in [
            'elasticSearchHostname',
            'elasticSearchPort',
            'elasticsearch_doctype',
            'elasticsearch_timeout',
            'facets_max_number',
            'searchMaxNumberOfDistinctSignatures',
            'platforms',
            'non_release_channels',
            'restricted_channels',
    ]:
        webapi[opt] = config.get(opt)

    required_config.webapi = webapi

    elasticsearch_url = 'http://' + config.elasticSearchHostname + ':9200'

    config_manager = ConfigurationManager([required_config],
                                          app_name='testapp',
                                          app_version='1.0',
                                          app_description='app description',
                                          values_source_list=[{
                                              'logger':
                                              mock_logging,
                                              'elasticsearch_index':
                                              es_index,
                                              'elasticsearch_urls':
                                              elasticsearch_url,
                                              'backoff_delays': [1, 2],
                                          }])

    return config_manager
Esempio n. 7
0
def _get_config_manager(config, es_index=None):
    if not es_index:
        es_index = config.elasticsearch_index

    mock_logging = mock.Mock()

    required_config = crashstorage.ElasticSearchCrashStorage.get_required_config()
    required_config.add_option("logger", default=mock_logging)

    webapi = Namespace()
    webapi.elasticsearch_index = es_index
    webapi.timeout = 2
    webapi.search_default_date_range = 7

    for opt in [
        "elasticSearchHostname",
        "elasticSearchPort",
        "elasticsearch_doctype",
        "elasticsearch_timeout",
        "facets_max_number",
        "searchMaxNumberOfDistinctSignatures",
        "platforms",
        "non_release_channels",
        "restricted_channels",
    ]:
        webapi[opt] = config.get(opt)

    required_config.webapi = webapi

    elasticsearch_url = "http://" + config.elasticSearchHostname + ":9200"

    config_manager = ConfigurationManager(
        [required_config],
        app_name="testapp",
        app_version="1.0",
        app_description="app description",
        values_source_list=[
            {
                "logger": mock_logging,
                "elasticsearch_index": es_index,
                "elasticsearch_urls": elasticsearch_url,
                "backoff_delays": [1, 2],
            }
        ],
    )

    return config_manager
Esempio n. 8
0
def _get_config_manager(config, es_index=None):
    if not es_index:
        es_index = config.elasticsearch_index

    mock_logging = mock.Mock()

    required_config = \
        crashstorage.ElasticSearchCrashStorage.get_required_config()
    required_config.add_option('logger', default=mock_logging)

    webapi = Namespace()
    webapi.elasticsearch_index = es_index
    webapi.timeout = 2
    webapi.search_default_date_range = 7

    for opt in [
        'elasticSearchHostname',
        'elasticSearchPort',
        'elasticsearch_doctype',
        'elasticsearch_timeout',
        'facets_max_number',
        'searchMaxNumberOfDistinctSignatures',
        'platforms',
        'non_release_channels',
        'restricted_channels',
    ]:
        webapi[opt] = config.get(opt)

    required_config.webapi = webapi

    elasticsearch_url = 'http://' + config.elasticSearchHostname + ':9200'

    config_manager = ConfigurationManager(
        [required_config],
        app_name='testapp',
        app_version='1.0',
        app_description='app description',
        values_source_list=[{
            'logger': mock_logging,
            'elasticsearch_index': es_index,
            'elasticsearch_urls': elasticsearch_url,
            'backoff_delays': [1, 2],
        }]
    )

    return config_manager
Esempio n. 9
0
def _get_config_manager(es_index=None):
    if not es_index:
        es_index = commonconfig.elasticsearch_index.default

    mock_logging = mock.Mock()

    required_config = \
        crashstorage.ElasticSearchCrashStorage.required_config
    required_config.add_option('logger', default=mock_logging)

    webapi = Namespace()
    webapi.elasticsearch_index = es_index
    webapi.timeout = 2
    webapi.search_default_date_range = 7

    for opt in [
        'elasticSearchHostname',
        'elasticSearchPort',
        'elasticsearch_doctype',
        'elasticsearch_timeout',
        'facets_max_number',
        'searchMaxNumberOfDistinctSignatures',
        'platforms',
        'channels',
        'restricted_channels',
    ]:
        webapi[opt] = getattr(commonconfig, opt).default

    required_config.webapi = webapi

    config_manager = ConfigurationManager(
        [required_config],
        app_name='testapp',
        app_version='1.0',
        app_description='app description',
        values_source_list=[{
            'logger': mock_logging,
            'elasticsearch_urls': commonconfig.elasticsearch_urls.default,
            'elasticsearch_index': es_index,
        }]
    )

    return config_manager