This does not seem to work
inorder.verify(watcher).session_connected(any(long), any(str), False)
inorder.verify(watcher).data_changed(self.chroot + '/pookie')
inorder.verify(watcher).data_changed(self.chroot + '/pookie')
inorder.verify(watcher).node_deleted(self.chroot + '/pookie')
inorder.verify(watcher).connection_closed()
verifyNoMoreInteractions(watcher)
I get
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/acabrera/dev/pookeeper/tests/test_client.py", line 278, in test_exists_watcher
inorder.verify(watcher).data_changed(self.chroot + '/pookie')
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/invocation.py", line 98, in __call__
verification.verify(self, len(matched_invocations))
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/verification.py", line 79, in verify
self.original_verification.verify(wanted_invocation, count)
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/verification.py", line 56, in verify
raise VerificationError("\nWanted times: %i, actual times: %i" % (self.wanted_count, actual_count))
VerificationError:
Wanted times: 1, actual times: 2
which is an error on the first verify for data_changed().
If change the inorder calls to:
inorder.verify(watcher).session_connected(any(long), any(str), False)
inorder.verify(watcher, times=2).data_changed(self.chroot + '/pookie')
inorder.verify(watcher).node_deleted(self.chroot + '/pookie')
inorder.verify(watcher).connection_closed()
verifyNoMoreInteractions(watcher)
I get
Traceback (most recent call last):
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/acabrera/dev/pookeeper/tests/test_client.py", line 279, in test_exists_watcher
inorder.verify(watcher).node_deleted(self.chroot + '/pookie')
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/invocation.py", line 98, in __call__
verification.verify(self, len(matched_invocations))
File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/verification.py", line 75, in verify
raise VerificationError("\nWanted %s to be invoked, got %s instead" % (wanted_invocation, invocation))
VerificationError:
Wanted node_deleted('/pookeeper/pookie') to be invoked, got data_changed('/pookeeper/pookie') instead