def test_init(self, mock_connect): junos.init(self.opts) self.assertTrue(junos.thisproxy.get("initialized")) mock_connect.assert_called_with( allow_agent=True, device_params={"name": "junos", "local": False, "use_filter": False}, host="junos", hostkey_verify=False, key_filename=None, password=None, port="960", sock_fd=None, ssh_config=ANY, username="******", )
def test_alive(self, mock_connect): junos.init(self.opts) junos.thisproxy["conn"]._conn._session._buffer = io.BytesIO() self.assertTrue(junos.alive(self.opts)) self.assertTrue(junos.thisproxy.get("initialized"))
def test_init_err(self, mock_connect): mock_connect.side_effect = ConnectError junos.init(self.opts) self.assertFalse(junos.thisproxy.get("initialized"))
def test_init(self, mock_connect): junos.init(self.opts) self.assertTrue(junos.thisproxy.get("initialized"))