def parametrized_setup(request, tmpdir):
    from postgraas_server.management_resources import db
    cfg = tmpdir.join('config')
    with open(cfg.strpath, "w") as fp:
        json.dump(CONFIGS[request.param], fp)

    config = configuration.get_config(cfg.strpath)
    this_app = create_app(config)
    this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
    this_app.use_reloader = False
    this_app.config['TESTING'] = True
    ctx = this_app.app_context()
    ctx.push()
    db.create_all()
    username, db_name = str(uuid.uuid4()).replace('-', '_'), str(
        uuid.uuid4()).replace('-', '_')
    request.cls.app_client = this_app.test_client()
    request.cls.db_name = remove_digits(db_name)
    request.cls.username = remove_digits(username)
    request.cls.backend = request.param
    yield
    if request.param == 'docker':
        delete_all_test_postgraas_container()
    elif request.param == 'pg_cluster':
        try:
            delete_test_database_and_user(db_name, username,
                                          dict(config.items('backend')))
        except Exception:
            pass
    db.drop_all()
    ctx.pop()
def parametrized_setup(request, tmpdir):
    from postgraas_server.management_resources import db
    cfg = tmpdir.join('config')
    with open(cfg.strpath, "w") as fp:
        json.dump(CONFIGS[request.param], fp)

    config = configuration.get_config(cfg.strpath)
    this_app = create_app(config)
    this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
    this_app.use_reloader = False
    this_app.config['TESTING'] = True
    ctx = this_app.app_context()
    ctx.push()
    db.create_all()
    username, db_name = str(uuid.uuid4()).replace('-', '_'), str(uuid.uuid4()).replace('-', '_')
    request.cls.app_client = this_app.test_client()
    request.cls.db_name = remove_digits(db_name)
    request.cls.username = remove_digits(username)
    request.cls.backend = request.param
    yield
    if request.param == 'docker':
        delete_all_test_postgraas_container()
    elif request.param == 'pg_cluster':
        try:
            delete_test_database_and_user(db_name, username, dict(config.items('backend')))
        except Exception:
            pass
    db.drop_all()
    ctx.pop()
def parametrized_setup(request, tmpdir):
    from postgraas_server.management_resources import db
    config = CONFIGS[request.param]
    this_app = create_app(config)
    this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
    this_app.use_reloader = False
    this_app.config['TESTING'] = True
    ctx = this_app.app_context()
    ctx.push()
    db.create_all()
    username, db_name = str(uuid.uuid4()).replace('-', '_'), str(
        uuid.uuid4()).replace('-', '_')
    request.cls.app_client = this_app.test_client()
    request.cls.db_name = remove_digits(db_name)
    request.cls.username = remove_digits(username)
    request.cls.backend = request.param
    yield
    if request.param == 'pg_cluster':
        #        try:
        delete_test_database_and_user(db_name, username, config['backend'])


#        except Exception:
#            pass
    db.drop_all()
    ctx.pop()
 def setUp(self):
     self.module_path = os.path.abspath(os.path.dirname(__file__))
     self.this_app = create_app(
         configuration.get_config(os.path.join(self.module_path, 'application.cfg'))
     )
     self.this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
     self.this_app.use_reloader = False
     self.this_app.config['TESTING'] = True
 def setUp(self):
     self.module_path = os.path.abspath(os.path.dirname(__file__))
     self.this_app = create_app(
         configuration.get_config(
             os.path.join(self.module_path, 'application.cfg')))
     self.this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
     self.this_app.use_reloader = False
     self.this_app.config['TESTING'] = True
 def setUp(self):
     self.module_path = os.path.abspath(os.path.dirname(__file__))
     self.this_app = create_app(configuration.get_config(os.path.join(self.module_path, 'postgraas_server.cfg')))
     #self.this_app.debug = True
     self.this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
     self.this_app.use_reloader = False
     self.this_app.config['TESTING'] = True
     self.app = self.this_app.test_client()
     self.delete_all_test_postgraas_container()
     from postgraas_server.management_resources import db
     with self.this_app.app_context():
         db.drop_all()
         db.create_all()
def docker_setup(request, tmpdir):
    from postgraas_server.management_resources import db
    cfg = tmpdir.join('config')
    with open(cfg.strpath, "w") as fp:
        json.dump(CONFIGS['docker'], fp)

    this_app = create_app(configuration.get_config(cfg.strpath))
    this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
    this_app.use_reloader = False
    this_app.config['TESTING'] = True
    ctx = this_app.app_context()
    ctx.push()
    db.create_all()
    request.cls.app_client = this_app.test_client()
    yield
    delete_all_test_postgraas_container()
    db.drop_all()
    ctx.pop()
def docker_setup(request, tmpdir):
    from postgraas_server.management_resources import db
    cfg = tmpdir.join('config')
    with open(cfg.strpath, "w") as fp:
        json.dump(CONFIGS['docker'], fp)

    this_app = create_app(configuration.get_config(cfg.strpath))
    this_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
    this_app.use_reloader = False
    this_app.config['TESTING'] = True
    ctx = this_app.app_context()
    ctx.push()
    db.create_all()
    request.cls.app_client = this_app.test_client()
    yield
    delete_all_test_postgraas_container()
    db.drop_all()
    ctx.pop()
import logging

from postgraas_server.configuration import get_config
from postgraas_server.create_app import create_app

logger = logging.getLogger(__name__)

app = create_app(get_config())

if __name__ == "__main__":
    app.run(debug=True, use_reloader=True)