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
def test_init(): utils.init('Secret_key')
def test_encrypt_int(): utils.init('Secret_key') e = utils.encrypt_value(42) assert e == 'bc729496af0697be'
def test_decrypt_str(): utils.init('Secret_key') d = utils.decrypt_value('bc729496af0697be') assert d == '42'
def test_encrypt_str(): utils.init('Secret_key') e = utils.encrypt_value('42') assert e == 'bc729496af0697be'