def test_report_event_large_event(self, patch_send_event, *args): event_list = TelemetryEventList() event_str = random_generator(2**18) event_list.events.append(get_event(message=event_str)) client = WireProtocol(wireserver_url).client client.report_event(event_list) self.assertEqual(patch_send_event.call_count, 0)
def _create_extension_event(self, size=0, name="DummyExtension", message="DummyMessage"): event_data = self._get_event_data(name=size if size != 0 else name, message=random_generator(size) if size != 0 else message) event_file = os.path.join(self.event_dir, "{0}.tld".format(int(time.time() * 1000000))) with open(event_file, 'wb+') as file_descriptor: file_descriptor.write(event_data.encode('utf-8'))
def test_report_event_small_event(self, patch_send_event, *args): event_list = TelemetryEventList() client = WireProtocol(wireserver_url).client event_str = random_generator(10) event_list.events.append(get_event(message=event_str)) event_str = random_generator(100) event_list.events.append(get_event(message=event_str)) event_str = random_generator(1000) event_list.events.append(get_event(message=event_str)) event_str = random_generator(10000) event_list.events.append(get_event(message=event_str)) client.report_event(event_list) # It merges the messages into one message self.assertEqual(patch_send_event.call_count, 1)