示例#1
0
 def test_read_trigger_timeout(self, _read_mock):
     # mocking the response into two parts, so we run into the timeout
     # check in the loop
     _read_mock.side_effect = [b"<foo>xyz<bar></bar>", b"</foo>"]
     connection = GvmConnection(timeout=0)
     with self.assertRaises(GvmError,
                            msg="Timeout while reading the response"):
         connection.read()
示例#2
0
 def test_read_no_data(self, _read_mock):
     _read_mock.return_value = None
     connection = GvmConnection()
     with self.assertRaises(GvmError, msg="Remote closed the connection"):
         connection.read()