Skip to content

Commit

Permalink
Fix for issue 239 (vmware#546)
Browse files Browse the repository at this point in the history
* Fix for issue 239

* Add unittest
  • Loading branch information
magianxd authored and tianhao64 committed May 9, 2017
1 parent 912e365 commit b8b43a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyVmomi/SoapAdapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,8 @@ def InvokeAccessor(self, mo, info):
if isinstance(e, self.SESSION_EXCEPTIONS):
# Our session might've timed out, change our state and retry.
self._SetStateUnauthenticated()
retriesLeft -= 1
continue
else:
raise e
return obj
Expand Down
13 changes: 13 additions & 0 deletions tests/test_vim_session_oriented_stub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tests

from pyVim import connect


class SoapAdapterTests(tests.VCRTestBase):
def test_invoke_method_login_session_exception(self):
def login_fail(*args, **kwargs):
raise vim_session.SESSION_EXCEPTIONS[0]()

stub = connect.SoapStubAdapter()
vim_session = connect.VimSessionOrientedStub(stub, login_fail)
self.assertRaises(SystemError, vim_session.InvokeAccessor, "mo", "info")

0 comments on commit b8b43a3

Please sign in to comment.