def test_construct_event_no_data(self): self.request_mock.get_data.return_value = None self.expected_dict["body"] = None actual_event_str = Service._construct_event(self.request_mock, 3000, binary_types=[]) self.assertEquals(json.loads(actual_event_str), self.expected_dict)
def test_construct_event_with_binary_data(self, should_base64_encode_patch): should_base64_encode_patch.return_value = True binary_body = b"011000100110100101101110011000010111001001111001" # binary in binary base64_body = base64.b64encode(binary_body).decode('utf-8') self.request_mock.get_data.return_value = binary_body self.expected_dict["body"] = base64_body self.expected_dict["isBase64Encoded"] = True actual_event_str = Service._construct_event(self.request_mock, 3000, binary_types=[]) self.assertEquals(json.loads(actual_event_str), self.expected_dict)
def test_construct_event_with_data(self): actual_event_str = Service._construct_event(self.request_mock, 3000, binary_types=[]) self.assertEquals(json.loads(actual_event_str), self.expected_dict)