Created
March 6, 2009 03:02
-
-
Save pope/74723 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def repeater(str): | |
| return str + str | |
| def hello(): | |
| return repeater("Hello") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mox | |
| import mymodule | |
| class TestHello(mox.MoxTestBase): | |
| def test_failing_hello(self): | |
| self.mox.StubOutWithMock(mymodule, 'repeater') | |
| mymodule.repeater("World").AndReturn("HelloWorld") | |
| self.mox.ReplayAll() | |
| mymodule.hello() | |
| def test_successful_hello(self): | |
| self.mox.StubOutWithMock(mymodule, 'repeater') | |
| mymodule.repeater("Hello").AndReturn("HelloWorld") | |
| self.mox.ReplayAll() | |
| self.assertEqual("HelloWorld", mymodule.hello()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from setuptools import setup, find_packages | |
| version = '0.1.0-SNAPSHOT' | |
| setup(name='mox_test', | |
| version=version, | |
| description="Testing Mox", | |
| packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), | |
| zip_safe=False, | |
| test_suite='nose.collector', | |
| tests_require=['nose', 'mox'], | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment