def setup(self): # this is needed to give each test # its own app config = os.getenv('TEST_CONFIG') if config is not None: app = create_app(config) else: app = create_app(__name__) with app.app_context(): from eudat_http_api.registration.models import db db.create_all() self.app = app self.client = app.test_client() self.storage_config = app.config['STORAGE'] if app.config['STORAGE'] == 'local': create_local_urls(self.url_list) elif app.config['STORAGE'] == 'irods': self.irods_config = (self.app.config['RODSHOST'], self.app.config['RODSPORT'], self.app.config['RODSZONE'] ) with self.app.app_context(): create_irods_urls(self.url_list, self.irods_config)
def setup_class(cls): config = os.getenv('TEST_CONFIG') if config is not None: app = create_app(config) else: app = create_app(__name__) if app.config['STORAGE'] == 'local': cls.url_list = get_local_url_list() elif app.config['STORAGE'] == 'irods': with app.app_context(): cls.url_list = get_irods_url_list(app.config['RODSZONE'])
def setup(self): config = os.getenv('TEST_CONFIG') if config is not None: app = create_app(config) else: app = create_app(__name__) self.app = app with app.app_context(): from eudat_http_api.registration.models import db db.create_all() self.client = app.test_client()
def setup_class(cls): config = os.getenv('TEST_CONFIG') if config is not None: app = create_app(config) else: app = create_app(__name__) cls.storage_config = app.config['STORAGE'] if app.config['STORAGE'] == 'local': cls.url_list = get_local_url_list() elif app.config['STORAGE'] == 'irods': with app.app_context(): cls.url_list = get_irods_url_list(app.config['RODSZONE'])
def setup(self): app = create_app(__name__) self.app = app with self.app.test_request_context(): from eudat_http_api.http_storage import localstorage try: localstorage.rmdir('/tmp/foo') except localstorage.NotFoundException: pass self.client = app.test_client()
#!/usr/bin/env python import logging from optparse import OptionParser from eudat_http_api import create_app parser = OptionParser() parser.add_option('-d', '--debug', dest='debug', help='Run app in debug mode', action='store_true', default=False) (options, args) = parser.parse_args() app = create_app('config') #jj: it does not work? options.debug = True if options.debug: print ' * Setting debug mode' app.config['DEBUG'] = True app.logger.setLevel(logging.ERROR) app.run(threaded=True, host=app.config['HOST'], port=app.config['PORT'])
from eudat_http_api.registration.models import db from eudat_http_api import create_app app = create_app('config') with app.app_context(): db.create_all()
def setUp(self): app = create_app('test_config') self.app = app self.client = app.test_client() db.create_all() registration_worker.set_config(app.config)
def setup(self): app = create_app(__name__) self.client = app.test_client()