예제 #1
0
def galaxy_init(galaxy_config: dict) -> None:
    # initialites galaxy configuration using some galaxy setups from galaxy.yml ('galaxy')
    # (database_connection, file_path, id_secret)

    logger.info("init from galaxy-config ")

    # Galaxy specific things:
    if 'galaxy' not in galaxy_config:
        raise RuntimeError('galaxy entry not found in galaxy config')

    if 'database_connection' not in galaxy_config['galaxy']:
        raise RuntimeError(
            'database_connection  entry not found in galaxy config')
    global db
    db.connect(galaxy_config['galaxy']['database_connection'])

    if 'file_path' not in galaxy_config['galaxy']:
        raise RuntimeError('file_path  entry not found in galaxy config')
    global galaxy_file_path
    galaxy_file_path = galaxy_config['galaxy']['file_path']

    if 'id_secret' not in galaxy_config['galaxy']:
        id_secret = "USING THE DEFAULT IS NOT SECURE!"
    else:
        id_secret = galaxy_config['galaxy']['id_secret']

    utils.init(id_secret)

    return
예제 #2
0
def test_init():

    utils.init('Secret_key')
예제 #3
0
def test_encrypt_int():
    utils.init('Secret_key')
    e = utils.encrypt_value(42)
    assert e == 'bc729496af0697be'
예제 #4
0
def test_decrypt_str():
    utils.init('Secret_key')
    d = utils.decrypt_value('bc729496af0697be')
    assert d == '42'
예제 #5
0
def test_encrypt_str():
    utils.init('Secret_key')
    e = utils.encrypt_value('42')
    assert e == 'bc729496af0697be'