Example #1
0
File: test.py Project: dugan/mockit
    def test_mock(self):
        path = '/tmp/thisfiledefinitely/doesntexist'
        assert(not os.path.exists(path))
        mockit.mock(os.path, 'exists')
        os.path.exists._mock.default_return_value = True
        assert(os.path.exists(path))

        old_stat = os.stat
        mockit.mock(os, 'stat')
        os.stat = old_stat
        mockit.unmock_all()
        assert(not os.path.exists(path))
Example #2
0
File: test.py Project: dugan/mockit
 def tearDown(self):
     mockit.unmock_all()
     return unittest.TestCase.tearDown(self)