# Path: pyehr/utils/services.py
# def get_service_configuration(configuration_file, logger=None):
#     if not logger:
#         logger = get_logger('service_configuration')
#     parser = SafeConfigParser(allow_no_value=True)
#     parser.read(configuration_file)
#     try:
#         conf = ServiceConfig(
#             parser.get('db', 'driver'),
#             parser.get('db', 'host'),
#             parser.get('db', 'database'),
#             parser.get('db', 'versioning_database'),
#             parser.get('db', 'port'),
#             parser.get('db', 'user'),
#             parser.get('db', 'passwd'),
#             parser.get('db', 'patients_repository'),
#             parser.get('db', 'ehr_repository'),
#             parser.get('db', 'ehr_versioning_repository'),
#             parser.get('index', 'url'),
#             parser.get('index', 'database'),
#             parser.get('index', 'user'),
#             parser.get('index', 'passwd'),
#             parser.get('db_service', 'host'),
#             parser.get('db_service', 'port'),
#             parser.get('db_service', 'server_engine'),
#             parser.get('query_service', 'host'),
#             parser.get('query_service', 'port'),
#             parser.get('query_service', 'server_engine')
#         )
#         return conf
#     except NoOptionError, nopt:
#         logger.critical('Missing option %s in configuration file', nopt)
#         return None


import os, unittest, requests, sys, time
    import simplejson as json
    import json
from copy import copy
from pyehr.utils.services import get_service_configuration
        from uuid import uuid4
try:
except ImportError:

CONF_FILE = os.getenv('SERVICE_CONFIG_FILE')


class TestDBService(unittest.TestCase):

    def __init__(self, label):
        super(TestDBService, self).__init__(label)
        if CONF_FILE is None:
            sys.exit('ERROR: no configuration file provided')

# Path: pyehr/utils/services.py
# def get_service_configuration(configuration_file, logger=None):
#     if not logger:
#         logger = get_logger('service_configuration')
#     parser = SafeConfigParser(allow_no_value=True)
#     parser.read(configuration_file)
#     try:
#         conf = ServiceConfig(
#             parser.get('db', 'driver'),
#             parser.get('db', 'host'),
#             parser.get('db', 'database'),
#             parser.get('db', 'versioning_database'),
#             parser.get('db', 'port'),
#             parser.get('db', 'user'),
#             parser.get('db', 'passwd'),
#             parser.get('db', 'patients_repository'),
#             parser.get('db', 'ehr_repository'),
#             parser.get('db', 'ehr_versioning_repository'),
#             parser.get('index', 'url'),
#             parser.get('index', 'database'),
#             parser.get('index', 'user'),
#             parser.get('index', 'passwd'),
#             parser.get('db_service', 'host'),
#             parser.get('db_service', 'port'),
#             parser.get('db_service', 'server_engine'),
#             parser.get('query_service', 'host'),
#             parser.get('query_service', 'port'),
#             parser.get('query_service', 'server_engine')
#         )
#         return conf
#     except NoOptionError, nopt:
#         logger.critical('Missing option %s in configuration file', nopt)
#         return None


# Path: test/services/test_dbservice.py
import os, unittest, requests, sys, time
    import simplejson as json
    import json
from copy import copy
from pyehr.utils.services import get_service_configuration
        from uuid import uuid4

try:
except ImportError:

CONF_FILE = os.getenv('SERVICE_CONFIG_FILE')


class TestDBService(unittest.TestCase):

    def __init__(self, label):
        super(TestDBService, self).__init__(label)
        if CONF_FILE is None:
            sys.exit('ERROR: no configuration file provided')

        sconf = get_service_configuration(CONF_FILE)