Ejemplo n.º 1
0
 def calls_agent_handler_close_if_enabled(self, Handler, client):
     c = Connection("host", forward_agent=True)
     c.create_session()
     c.close()
     # NOTE: this will need to change if, for w/e reason, we ever want
     # to run multiple handlers at once
     Handler.return_value.close.assert_called_once_with()
Ejemplo n.º 2
0
 def short_circuits_if_not_connected(self, client):
     c = Connection("host")
     # Won't trigger close() on client because it'll already think it's
     # closed (due to no .transport & the behavior of .is_connected)
     c.close()
     assert not client.close.called
Ejemplo n.º 3
0
 def calls_SSHClient_close(self, client):
     "calls paramiko.SSHClient.close()"
     c = Connection("host")
     c.open()
     c.close()
     client.close.assert_called_with()
Ejemplo n.º 4
0
 def has_no_required_args_and_returns_None(self, client):
     c = Connection("host")
     c.open()
     assert c.close() is None