Exemplo n.º 1
0
    def test_dev_config(self):
        app = create_app('gcis.settings.DevConfig', env='dev')

        assert app.config['DEBUG'] is True
        assert app.config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db'
        assert app.config['SQLALCHEMY_ECHO'] is True
        assert app.config['CACHE_TYPE'] == 'null'
Exemplo n.º 2
0
    def test_dev_config(self):
        app = create_app('gcis.settings.DevConfig', env='dev')

        assert app.config['DEBUG'] is True
        assert app.config[
            'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db'
        assert app.config['SQLALCHEMY_ECHO'] is True
        assert app.config['CACHE_TYPE'] == 'null'
Exemplo n.º 3
0
 def setup(self):
     app = create_app('gcis.settings.DevConfig', env='dev')
     self.app = app.test_client()
     db.app = app
     db.create_all()
     admin = User('admin', 'supersafepassword')
     db.session.add(admin)
     db.session.commit()
Exemplo n.º 4
0
        # split attributes
        if 'attributes' in md and isinstance(md['attributes'],
                                             types.StringTypes):
            md['attributes'] = [i.strip() for i in md['attributes'].split(',')]

        try:
            conn.index(md, index, gcis_type, md['identifier'])
        except Exception, e:
            print("Got error: %s" % str(e))
            with open('errors/%s.json' % md['identifier'], 'w') as f:
                json.dump(md, f, indent=2)
            continue


if __name__ == "__main__":
    env = os.environ.get('GCIS_ENV', 'prod')
    app = create_app('gcis.settings.%sConfig' % env.capitalize(), env=env)
    es_url = app.config['ELASTICSEARCH_URL']
    gcis_url = app.config['GCIS_REST_URL']
    index = app.config['GCIS_ELASTICSEARCH_INDEX']

    index_reports(gcis_url, es_url, index)
    index_chapters(gcis_url, es_url, index)
    index_figures(gcis_url, es_url, index)
    index_findings(gcis_url, es_url, index)
    index_tables(gcis_url, es_url, index)
    platforms_by_instr = index_platforms(gcis_url, es_url, index)
    index_instruments(gcis_url, es_url, index, platforms_by_instr)
    index_datasets(gcis_url, es_url, index)
Exemplo n.º 5
0
#!/usr/bin/env python
import os

from flask.ext.script import Manager, Server
from gcis import create_app
from gcis.models import db, User

# default to dev config because no one should use this in
# production anyway
env = os.environ.get('GCIS_ENV', 'dev')
app = create_app('gcis.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())


@manager.shell
def make_shell_context():
    """ Creates a python REPL with several default imports
        in the context of the app
    """

    return dict(app=app, db=db, User=User)


@manager.command
def createdb():
    """ Creates a database with all of the tables defined in
        your Alchemy models
    """
Exemplo n.º 6
0
    def test_prod_config(self):
        app = create_app('gcis.settings.ProdConfig', env='prod')

        assert app.config[
            'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db'
        assert app.config['CACHE_TYPE'] == 'simple'
Exemplo n.º 7
0
 def setup(self):
     app = create_app('gcis.settings.DevConfig', env='dev')
     self.app = app.test_client()
     db.app = app
     db.create_all()
Exemplo n.º 8
0
    def test_prod_config(self):
        app = create_app('gcis.settings.ProdConfig', env='prod')

        assert app.config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db'
        assert app.config['CACHE_TYPE'] == 'simple'