Here are the examples of the python api mock.sentinel.mock taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
Example 1
Project: exam Source File: test_cases.py
def test_patcher_patches_object_on_setup_and_adds_patcher_to_cleanup(self):
case = CaseWithPatcher()
self.assertNotEqual(get_thing(), sentinel.mock)
case.run()
self.assertEqual(get_thing(), sentinel.mock)
[cleanup() for cleanup in case.cleanups]
self.assertNotEqual(get_thing(), sentinel.mock)
3
Example 2
Project: exam Source File: test_cases.py
def test_patcher_lifecycle_works_on_subclasses(self):
case = SubclassedCaseWithPatcher()
self.assertNotEqual(get_thing(), sentinel.mock)
case.run()
self.assertEqual(get_thing(), sentinel.mock)
[cleanup() for cleanup in case.cleanups]
self.assertNotEqual(get_thing(), sentinel.mock)
0
Example 3
@patcher('tests.dummy.thing')
def dummy_thing(self):
return sentinel.mock
0
Example 4
Project: exam Source File: test_cases.py
def test_patcher_start_value_is_added_to_case_dict_on_run(self):
case = CaseWithPatcher()
case.run()
self.assertEqual(case.vars_when_run['dummy_thing'], sentinel.mock)