コード例 #1
0
from guillotina import testing


def settings_configurator(settings):
    settings.setdefault("applications", [])
    if "simpleserver" not in settings:
        settings["applications"].append("simpleserver")


testing.configure_with(settings_configurator)
コード例 #2
0
        settings['applications'] = list()

    if 'guillotina_elasticsearch' in settings['applications']:
        settings['applications'].append('guillotina_elasticsearch')

    settings['applications'].append('guillotina_fhirfield')
    settings['applications'].append('guillotina_fhirfield.tests.fhir_contents')

    settings['elasticsearch'] = {
        "index_name_prefix": "guillotina-",
        "connection_settings": {
            "hosts": [
                '{}:{}'.format(
                    getattr(elasticsearch, 'host', 'localhost'),
                    getattr(elasticsearch, 'port', '9200'),
                )
            ],
            "sniffer_timeout":
            None
        }
    }
    settings["load_utilities"]["catalog"] = {
        "provides":
        "guillotina_elasticsearch.utility.IElasticSearchUtility",  # noqa
        "factory": "guillotina_elasticsearch.utility.ElasticSearchUtility",
        "settings": {}
    }


testing.configure_with(base_settings_configurator)
コード例 #3
0
ファイル: fixtures.py プロジェクト: nazrulworld/guillotina
DB_SCHEMA = os.environ.get('DB_SCHEMA', 'public')

annotations = {
    'testdatabase': DATABASE,
    'test_dbschema': DB_SCHEMA,
    'travis': IS_TRAVIS
}

def base_settings_configurator(settings):
    settings["load_utilities"]['catalog'] = {
        "provides": "guillotina.interfaces.ICatalogUtility",
        "factory": "guillotina.catalog.catalog.DefaultSearchUtility"
    }


testing.configure_with(base_settings_configurator)


def get_dummy_settings():
    settings = testing.get_settings()
    settings['databases']['db']['storage'] = 'DUMMY'
    settings['databases']['db']['dsn'] = {}
    return settings


def configure_db(obj, scheme='postgres', dbname='guillotina', user='******',
                 host='localhost', port=5432, password='', storage='postgresql'):
    obj.update({
        'storage': storage,
        'partition': 'guillotina.interfaces.IResource'
    })