Exemplo n.º 1
0
  def test_telnetclient_disconnect(self, mocked):
    """ Test disconnect() method """
    telnetclientconf={"host":"host","port":20000}
    telnetclient = TelnetClient(telnetclientconf)

    # Call
    telnetclient.connect()
    telnetclient.disconnect()
    telnetclient.client.close.assert_called_with()
Exemplo n.º 2
0
  def test_telnetclient_disconnect_exception(self, mocked):
    """ Test disconnect() method with exception raised """
    mocked.side_effect=Exception("In your face !")

    telnetclientconf={"host":"host","port":20000}
    telnetclient = TelnetClient(telnetclientconf)

    with self.assertRaises(TelnetClientException):
      telnetclient.disconnect()