def test_dev_config(self): app = create_app('fv_prov_es.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'
def setup(self): app = create_app('fv_prov_es.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()
def setup(self): app = create_app("fv_prov_es.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()
def test_dev_config(self): app = create_app('fv_prov_es.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'
def test_prod_config(self): app = create_app('fv_prov_es.settings.ProdConfig', env='prod') assert app.config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db' assert app.config['CACHE_TYPE'] == 'simple'
refList = [] ref_path = "%s/reference"%dump_dir for (root,dirs,files) in os.walk(ref_path): for f in files: f = "%s/%s"%(ref_path, f) with open(f) as item: ref = json.load(item) refList.append(ref) return refList if __name__ == "__main__": if sys.argv[1] is not None: if os.path.exists(sys.argv[1]): dump_dir = sys.argv[1] env = os.environ.get('PROVES_ENV', 'prod') app = create_app('fv_prov_es.settings.%sConfig' % env.capitalize(), env=env) es_url = app.config['ES_URL'] gcis_url = "https://data.globalchange.gov"#"https://gcis-search-stage.jpl.net:3000" dt = datetime.utcnow() index = "%s-gcis" % app.config['PROVES_ES_PREFIX'] alias = app.config['PROVES_ES_ALIAS'] index_gcis(gcis_url, es_url, index, alias, dump_dir) else: print "Argument provided is not a directory" else: print "Requires an argument for dump directory"
verify=False) r.raise_for_status() docs = r.json() #print(json.dumps(images, indent=2)) #print(len(images)) for doc in docs: doc_id = doc['identifier'] doc_href = doc['href'] r2 = requests.get(doc_href, params={'all': 1}, verify=False) r2.raise_for_status() doc_md = r2.json() #print(json.dumps(doc_md, indent=2)) prov = get_doc_prov(doc_md, gcis_url) #print(json.dumps(prov, indent=2)) import_prov(conn, index, alias, prov) if __name__ == "__main__": env = os.environ.get('PROVES_ENV', 'prod') app = create_app('fv_prov_es.settings.%sConfig' % env.capitalize(), env=env) es_url = app.config['ES_URL'] #gcis_url = "http://data.globalchange.gov" gcis_url = "https://gcis-search-stage.jpl.net:3000" dt = datetime.utcnow() #index = "%s-%04d.%02d.%02d" % (app.config['PROVES_ES_PREFIX'], # dt.year, dt.month, dt.day) index = "%s-gcis" % app.config['PROVES_ES_PREFIX'] alias = app.config['PROVES_ES_ALIAS'] index_gcis(gcis_url, es_url, index, alias)
def setup(self): app = create_app('fv_prov_es.settings.DevConfig', env='dev') self.app = app.test_client() db.app = app db.create_all()
def test_prod_config(self): app = create_app('fv_prov_es.settings.ProdConfig', env='prod') assert app.config[ 'SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db' assert app.config['CACHE_TYPE'] == 'simple'