Ejemplo n.º 1
0
 def setUp(self):
     data = {
         'DB_CONNECTION': 'sqlite:///{}'.format(self.SQLLITE_FILE),
         'MAILER_TYPE': 'QUEUE',
         'MAILGUN_API_KEY': 'whatever',
         'MAILGUN_DOMAIN': 'whatever',
         'LOGGING_LEVEL': 'DEBUG',
         'DONOTREPLY_EMAIL_ADDRESS': '*****@*****.**',
         'SUPPORT_EMAIL_ADDRESS': '*****@*****.**',
         'BUG_EMAIL_ADDRESS': '*****@*****.**',
         'ABUSE_EMAIL_ADDRESS': '*****@*****.**',
         'NOTIFY_EMAIL_ADDRESS': '*****@*****.**',
         'ADMIN_EMAIL_ADDRESSES': '*****@*****.**',
         'BASEURL': 'localhost:5000/',
         'S3_BUCKETNAME': os.environ['COMMUNITYSHARE_S3_BUCKETNAME'],
         'S3_KEY': os.environ['COMMUNITYSHARE_S3_KEY'],
         'S3_USERNAME': os.environ['COMMUNITYSHARE_S3_USERNAME'],
         'UPLOAD_LOCATION': os.environ['COMMUNITYSHARE_UPLOAD_LOCATION'],
         'COMMIT_HASH': 'dummy123',
         'ENCRYPTION_KEY': CryptHelper.generate_key(),
     }
     config.load_from_dict(data)
     setup.init_db()
     # Clear mail queue
     mailer = mail.get_mailer()
     while len(mailer.queue):
         mailer.pop()
     self.app = app.make_app().test_client()
Ejemplo n.º 2
0
 def setUp(self):
     config.load_config('./config.dev.json')
     config.MAILER_TYPE = 'QUEUE'
     config.DB_CONNECTION = 'sqlite:///{}'.format(self.SQLLITE_FILE)
     # When config.load_config is called, it sets self as the config in the
     # global store. Since we have mutated the config manually, we need to
     # re-set_config it in store.
     store.set_config(config)
     setup.init_db()
     # Clear mail queue
     mailer = mail.get_mailer()
     while len(mailer.queue):
         mailer.pop()
     self.app = app.make_app().test_client()
Ejemplo n.º 3
0
 def setUp(self):
     config.load_config('./config.dev.json')
     config.MAILER_TYPE = 'QUEUE'
     config.DB_CONNECTION = 'sqlite:///{}'.format(self.SQLLITE_FILE)
     # When config.load_config is called, it sets self as the config in the
     # global store. Since we have mutated the config manually, we need to
     # re-set_config it in store.
     store.set_config(config)
     setup.init_db()
     # Clear mail queue
     mailer = mail.get_mailer()
     while len(mailer.queue):
         mailer.pop()
     self.app = app.make_app().test_client()
import logging
import sys

from community_share import config, app

logger = logging.getLogger(__name__)

logger.info('Loading settings from environment')
config.load_config('./config.dev.json')

if 'production' == config.APP_ENV:
    sys.exit('Cannot run development app with production config')

logger.info('Making application')
app = app.make_app()
app.debug = True
logger.info('Debug={0}'.format(app.debug))
app.run(host='0.0.0.0', port=5000, extra_files=['./manifest.json'])
import logging
import sys

from community_share import config, app

logger = logging.getLogger(__name__)

logger.info('Loading settings from environment')
config.load_config('./config.production.json')

if not 'production' == config.APP_ENV:
    sys.exit('Cannot run production app without production config')

logger.info('Making application')
app = app.make_app()
app.debug = False
logger.info('Debug={0}'.format(app.debug))