def setUp(self): super().setUp() connect('metaddata', host='mongomock://localhost', alias='metadata') test_dir = tempfile.mkdtemp('test_home') storage.from_config({'home': test_dir}) config = { "auth_key_file": "config/auth.key", "celery_config": "config/celery_config.json", "metadata_config": {}, } self.SECRET_KEY = open(config["auth_key_file"]).read() self.app = webapi.main(config)
def from_config(config_file=None): if type(config_file) is str: with open(config_file) as f: config = json.load(f) elif type(config_file) is dict: config = config_file elif config_file is None: return {} celery_config = config.get('celery_config', None) if celery_config: manager.from_config(celery_config) metadata_config = config.get('metadata_config', None) if metadata_config: metadata.from_config(metadata_config) storage_config = config.get('storage_config', None) if storage_config: storage.from_config(storage_config) return config
def setUp(self): super().setUp() connect('metaddata', host='mongomock://localhost', alias='metadata') storage.from_config('config/storage_config.json')