def test_pattern(self): 'Test probes are filled with the requested bit pattern' with mtrpacket.PacketListen('-4') as listen: cmd = '20 send-probe ip-4 127.0.0.1 bit-pattern 44' self.write_command(cmd) self.assertEqual(listen.attrib['bitpattern'], '44')
def test_tos(self): 'Test setting the TOS field' with mtrpacket.PacketListen('-4') as listen: cmd = '20 send-probe ip-4 127.0.0.1 tos 62' self.write_command(cmd) self.assertEqual(listen.attrib['tos'], '62')
def test_size(self): 'Test probes sent with an explicit packet size' with mtrpacket.PacketListen('-4') as listen: cmd = '20 send-probe ip-4 127.0.0.1 size 512' self.write_command(cmd) self.assertEqual(listen.attrib['size'], '512')
def test_param(self): 'Test a variety of packet parameters' with mtrpacket.PacketListen('-6') as listen: param = 'size 256 bit-pattern 51 tos 77' cmd = '20 send-probe ip-6 ::1 ' + param self.write_command(cmd) self.assertEqual(listen.attrib['size'], '256') self.assertEqual(listen.attrib['bitpattern'], '51')