Beispiel #1
0
def _Expect(network_socket, prompt, expected):
  """Write single line to the UFT server and look for the expected response"""
  if prompt:
    _Send(network_socket, prompt)
    _Send(network_socket, b'\r\n')
    print('Sent:', prompt)

  if expected:
    expected = str(expected)  # Might be an integer
    actual = network_socket.recv(512).decode(encoding='utf-8')
    if not actual.startswith(expected):
      raise client.BadStatusLine(
          '\nSent: {:s},\nExpected: {:s},\nReceived: {:s}'.format(prompt,
                                                                  expected,
                                                                  actual))
Beispiel #2
0
 def test_bad_status_repr(self):
     exc = client.BadStatusLine('')
     self.assertEqual(repr(exc), '''BadStatusLine("\'\'",)''')
Beispiel #3
0
 def test_bad_status_repr(self):
     exc = client.BadStatusLine('')
     if not utils.PY3:
         self.assertEqual(repr(exc), '''BadStatusLine("u\'\'",)''')
     else:
         self.assertEqual(repr(exc), '''BadStatusLine("\'\'",)''')