예제 #1
0
 def _reset_database(self):
     self._database_access = init_database(
         "test_skeleton_of",
         _data_files=[os.path.join(script_dir, "../../testing/data_struct.json")],
         _json_schema_folders=[os.path.join(script_dir, "../../../schemas/namespaces")],
         _uri_handlers={"ref": of_uri_handler},
     )
예제 #2
0
파일: init_env.py 프로젝트: OptimalBPM/of
def init_env(_database_name = "test_of", _context=None, _data_files=[], _json_schema_folders=[], _uri_handlers={}):
    """
    Initiates the test_broker database
    :param _context: If set, logs in and adds db_access, auth, session_id and peer_process_id properties
    :return:
    """
    _data_files += [os.path.join(script_dir, "data_struct.json")]



    _json_schema_folders = [of_schema_folder()] + _json_schema_folders
    _uri_handlers.update({"ref": None})

    _db_access = init_database(_database_name, _data_files=_data_files,
                               _json_schema_folders=_json_schema_folders,
                               _uri_handlers=_uri_handlers)



    if _context:
        _context.db_access = _db_access
        _context.auth = init_authentication(MongoDBAuthBackend(_context.db_access))

        _context.session_id, _context.user = _context.auth.login(
            {"usernamePassword": {"username": "******", "password": "******"}})

        _context.peer_process_id = str(ObjectId())