def __init__(self, report_processor, env_data): self.__report_processor = report_processor self.__name = env_data["name"] if "config_file" in env_data: self.__config = GhostFile( file_role=env_file_role_codes.BOOTH_CONFIG, content=env_data["config_file"]["content"]) self.__key_path = env_data["key_path"] self.__key = GhostFile(file_role=env_file_role_codes.BOOTH_KEY, content=env_data["key_file"]["content"]) else: self.__config = RealFile( file_role=env_file_role_codes.BOOTH_CONFIG, file_path=get_config_file_name(env_data["name"]), ) self.__set_key_path(get_key_path(env_data["name"]))
def test_raises_when_trying_read_nonexistent_file(self): assert_raise_library_error( lambda: GhostFile("some role", content=None).read(), (severities.ERROR, report_codes.FILE_DOES_NOT_EXIST, { "file_role": "some role", }), )
def __init__(self, report_processor, env_data): self.__report_processor = report_processor self.__name = (env_data["name"] if env_data["name"] is not None else DEFAULT_BOOTH_NAME) if "config_file" in env_data: self.__config = GhostFile( file_role=env_file_role_codes.BOOTH_CONFIG, content=env_data["config_file"]["content"]) self.__key_path = env_data["key_path"] self.__key = GhostFile(file_role=env_file_role_codes.BOOTH_KEY, content=env_data["key_file"]["content"], is_binary=True) else: self.__config = RealFile( file_role=env_file_role_codes.BOOTH_CONFIG, file_path=get_config_file_name(self.name), ) self.__set_key_path(get_key_path(self.name))