def manage(args): # detect mode. if args.mode == "maintain_matches": managment.maintain_matches() elif args.mode == "maintain_users": managment.maintain_users() elif args.mode == "maintain_filters": managment.maintain_filters() elif args.mode == "reannotate_trials": managment.reannotate_trials() elif args.mode == "maintain_elastic": managment.maintain_elastic()
def test_maintain_filters(self): # create matches. filter_id_1 = self._insert_filter() filter_id_2 = self._insert_filter() # clear the descriptions. filter_cnt = self.db['filter'].find().count() self.db['filter'].update_many({}, {"$set": {"description": ""}}) # re-calculation description. managment.maintain_filters() # assert they are not empty. filters = list(self.db['filter'].find()) assert len(filters) == filter_cnt for f in filters: assert len(f['description']) > 1