Exemplo n.º 1
0
    def test_partial_output(self):
        """Partial lines of output, for instance from a timeout."""
        success, failed, unreachable = host_discovery.process_ping_output([
            '192.168.50.11 | UNREACH', 'Hello', '192.168.50.12 | ', 'Hello',
            '192.168', 'Hello'
        ])

        self.assertEqual(success, set())
        self.assertEqual(failed, set())
        self.assertEqual(unreachable, set())
Exemplo n.º 2
0
 def test_process_ping_output(self):
     """The output of a three-host scan"""
     success, failed = host_discovery.process_ping_output([
         '192.168.50.11 | SUCCESS | rc=0 >>', 'Hello',
         '192.168.50.12 | SUCCESS | rc=0 >>', 'Hello',
         '192.168.50.10 | SUCCESS | rc=0 >>', 'Hello'
     ])
     self.assertEqual(
         success, set(['192.168.50.10', '192.168.50.11', '192.168.50.12']))
     self.assertEqual(failed, set())
Exemplo n.º 3
0
 def test_process_ping_output_fail(self):
     """The output of a three-host scan"""
     success, failed = host_discovery.process_ping_output([
         '192.168.50.11 | UNREACHABLE! => {', '     "changed": false,',
         '     "msg": "Failed to connect to the host via ssh ...",',
         '     "unreachable": true', '    }', 'Hello',
         '192.168.50.12 | SUCCESS | rc=0 >>', 'Hello',
         '192.168.50.10 | SUCCESS | rc=0 >>', 'Hello'
     ])
     self.assertEqual(success, set(['192.168.50.10', '192.168.50.12']))
     self.assertEqual(failed, set(['192.168.50.11']))