~jkakar/mocker/testresources-support

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Gustavo Niemeyer
  • Date: 2007-12-05 01:47:03 UTC
  • Revision ID: gustavo@niemeyer.net-20071205014703-lqtks7qqbulg13nu
MockerTestCase now verifies if the mocker is put in replay
mode in cases where events were recorded.

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
            self.assertEquals(str(e), str(expected_error))
326
326
            self.assertEquals(type(e), type(expected_error))
327
327
 
 
328
    def test_raises_runtime_error_if_not_in_replay_mode_with_events(self):
 
329
        class MyTest(MockerTestCase):
 
330
            def test_method(self):
 
331
                pass
 
332
 
 
333
        test = MyTest("test_method")
 
334
 
 
335
        # That's fine.
 
336
        test.test_method()
 
337
 
 
338
        test.mocker.add_event(Event())
 
339
 
 
340
        # That's not.
 
341
        self.assertRaises(RuntimeError, test.test_method)
 
342
 
 
343
        test.mocker.replay()
 
344
 
 
345
        # Fine again.
 
346
        test.test_method()
 
347
 
328
348
    def test_mocker_is_verified_and_restored_after_test_method_is_run(self):
329
349
        calls = []
330
350
        class MyEvent(Event):