Mockito is a spying framework based on Java library with the same name.
- To install:
$ python setup.py install
- To run all tests:
$ python setup.py test
- For more info, see:
Feel free to contribute more documentation or feedback!
- Our user and developer discussion group is:
- Mockito is licensed under the MIT license
- Library was tested with the following Python versions:
Python 2.4.6 Python 2.5.4 Python 2.6.1 Python 2.7 Python 3.1.2
- (Generated from mockito_demo_test.py) Basic usage:
import unittest from mockito import mock, when, verify
- class DemoTest(unittest.TestCase):
- def testStubbing(self):
# create a mock ourMock = mock()
# stub it when(ourMock).getStuff("cool").thenReturn("cool stuff")
# use the mock self.assertEqual("cool stuff", ourMock.getStuff("cool"))
# what happens when you pass different argument? self.assertEqual(None, ourMock.getStuff("different argument"))
- def testVerification(self):
# create a mock theMock = mock()
# use the mock theMock.doStuff("cool")
# verify the interactions. Method and parameters must match. Otherwise verification error. verify(theMock).doStuff("cool")
Commit History @debian/0.5.2-4_0kali1
- Merge branch 'debian' Sophie Brun 9 years ago
- Merge branch 'upstream' into debian Sophie Brun 9 years ago
- Merge branch 'upstream' Sophie Brun 9 years ago
- Imported Upstream version 0.5.2 Sophie Brun 9 years ago
- Drop unwanted gbp.conf Sophie Brun 9 years ago
- Imported Upstream version 0.5.2 Sophie Brun 9 years ago
- Drop openstack-pkg-tools Sophie Brun 9 years ago
- Import new version from debian Sophie Brun 9 years ago
- Imported Debian patch 0.5.2-4 Thomas Goirand (commit: Sophie Brun) 9 years ago
- Add a patch to use standard setuptools Sophie Brun 9 years ago
- Initial packaging for kali Sophie Brun 9 years ago
- Imported Upstream version 0.5.2 Sophie Brun 9 years ago