def entity(): """Return /api/entity endpoint.""" entity_name = { 'entity_name_full': config.get('ENTITY_NAME_FULL'), 'entity_name_short': config.get('ENTITY_NAME_SHORT'), 'entity_name_legal': config.get('ENTITY_NAME_LEGAL') } return jsonify(entity_name=entity_name)
def hello_world(): """Route endpoint.""" return jsonify(hello='world', app='depositaire', debug=config.get('DEBUG'), version=config.get('VERSION'))
def test_config_get(self): """Test get method.""" self.assertIsInstance(config.get('TITLE'), str)
"""Connects to the database.""" import sqlite3 import mysql.connector as mysql from depositaire import config if config.get('DB_TYPE').upper() == 'MARIADB': conn = mysql.connect( user=config.get('DB_USER'), password=config.get('DB_PASS'), host=config.get('DB_HOST'), port=config.getint('DB_PORT'), database=config.get('DB_NAME'), ) else: conn = sqlite3.connect(config.get('DB_FILE') or 'depositaire.sqlite', check_same_thread=False) def get(): """ Return the database connection object. Returns: The database connection object. """ return conn
def test_config_autoprefixing(self): """Ensure returned values are the same with or without prefixes.""" self.assertEqual(config.get('TITLE'), config.get('DEPOSITAIRE_TITLE'))