Ejemplo n.º 1
0
def redis_md():
    tempdir = tempfile.TemporaryDirectory()
    db_path = os.path.join(tempdir.name, 'test.db')
    config = {'SQLITE_MD_DB_PATH': db_path}
    config.update(config_dev)
    app = run.edusign_init_app('testing', config)
    # return tempdir, since once it goes out of scope, it is removed
    yield tempdir, RedisMD(app)
Ejemplo n.º 2
0
def _get_test_s3_app(config):
    more_config = {
        'STORAGE_CLASS_PATH': 'edusign_webapp.document.storage.s3.S3Storage',
        'AWS_REGION_NAME': 'us-east-1'
    }
    more_config.update(config)
    app = run.edusign_init_app('testing', more_config)
    app.api_client.api_base_url = 'https://dummy.edusign.api'
    return app
Ejemplo n.º 3
0
def client(request):
    app = run.edusign_init_app('testing', request.param)
    app.config.update(request.param)
    app.api_client.api_base_url = 'https://dummy.edusign.api'

    with app.test_client() as client:
        client.environ_base.update(_environ_base)

        yield client
Ejemplo n.º 4
0
def _get_test_app(config):
    tempdir = tempfile.TemporaryDirectory()
    db_path = os.path.join(tempdir.name, 'test.db')
    more_config = {
        'LOCAL_STORAGE_BASE_DIR': tempdir.name,
        'SQLITE_MD_DB_PATH': db_path
    }
    more_config.update(config)
    app = run.edusign_init_app('testing', more_config)
    app.api_client.api_base_url = 'https://dummy.edusign.api'
    return tempdir, app
Ejemplo n.º 5
0
def client_non_whitelisted(request):
    app = run.edusign_init_app('testing')
    app.config.update(request.param)
    app.api_client.api_base_url = 'https://dummy.edusign.api'

    with app.test_client() as client:
        environ = deepcopy(_environ_base)
        environ['HTTP_EDUPERSONPRINCIPALNAME'] = b'*****@*****.**'
        client.environ_base.update(environ)

        yield client
Ejemplo n.º 6
0
def doc_store_local_redis():
    tempdir = tempfile.TemporaryDirectory()
    config = {
        'STORAGE_CLASS_PATH':
        'edusign_webapp.document.storage.local.LocalStorage',
        'DOC_METADATA_CLASS_PATH':
        'edusign_webapp.document.metadata.redis_client.RedisMD',
        'LOCAL_STORAGE_BASE_DIR': tempdir.name,
    }
    config.update(config_dev)
    app = run.edusign_init_app('testing', config)
    # return tempdir, since once it goes out of scope, it is removed
    yield tempdir, DocStore(app)
Ejemplo n.º 7
0
def doc_store_local_sqlite():
    tempdir = tempfile.TemporaryDirectory()
    db_path = os.path.join(tempdir.name, 'test.db')
    config = {
        'STORAGE_CLASS_PATH':
        'edusign_webapp.document.storage.local.LocalStorage',
        'DOC_METADATA_CLASS_PATH':
        'edusign_webapp.document.metadata.sqlite.SqliteMD',
        'LOCAL_STORAGE_BASE_DIR': tempdir.name,
        'SQLITE_MD_DB_PATH': db_path,
    }
    config.update(config_dev)
    app = run.edusign_init_app('testing', config)
    # return tempdir, since once it goes out of scope, it is removed
    yield tempdir, DocStore(app)