def __init__( self, sample_event_file_path, # type: str expected_report_file_path, # type: str config_file_path, # type: str delete_reports_when_done=False # type: bool ): """ Some prep work. """ configs = self.load_configs(config_file_path) # type: dict self.__env_vars = self.env_vars_from_configs(configs) # type: Dict self.set_env_vars_to_os(self.__env_vars) self.ts = self.build_ts_client() self.test_event = self.dict_from_file( sample_event_file_path) # type: Dict self.expected_report = Report.from_dict( self.dict_from_file(expected_report_file_path)) # type: Dict self.delete_reports_when_done = delete_reports_when_done # type: bool
def attempt_lambda(self, test_event): # type: (Dict) -> Report """ Attempts the lambda. """ logger.info("attempting lambda.") d = lambda_handler(test_event, {}) logger.info("lambda attempt complete, success.") return Report.from_dict(d)