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()
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
def calls_SSHClient_close(self, client): "calls paramiko.SSHClient.close()" c = Connection("host") c.open() c.close() client.close.assert_called_with()
def has_no_required_args_and_returns_None(self, client): c = Connection("host") c.open() assert c.close() is None