def test_short_command(self): # Setup packet = Packet(LOCAL_ID, self.contact, ORIGIN_CONTACT_HEADER, COMMAND, self.settings) packets = split_to_assembly_packets(b'testcommand', COMMAND) for p in packets: packet.add_packet(p) # Test self.assertEqual(packet.assemble_command_packet(), b'testcommand') self.assertEqual(packet.log_masking_ctr, 0)
def test_long_command(self): # Setup packet = Packet(LOCAL_ID, self.contact, ORIGIN_CONTACT_HEADER, COMMAND, self.settings) command = os.urandom(500) packets = split_to_assembly_packets(command, COMMAND) for p in packets: packet.add_packet(p) # Test self.assertEqual(packet.assemble_command_packet(), command) self.assertEqual(packet.log_masking_ctr, 0)
def test_long_command(self): # Setup account = 'local' contact = create_contact('local') origin = ORIGIN_CONTACT_HEADER type_ = 'command' settings = Settings() packet = Packet(account, contact, origin, type_, settings) command = os.urandom(500) packets = self.mock_command_preprocessor(command) # Test for p in packets: packet.add_packet(p) purp_cmd = packet.assemble_command_packet() self.assertEqual(purp_cmd, command)