Here are the examples of the python api mock.sentinel.some_object taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
Example 1
Project: anki-sync-server Source File: test_collection.py
def test_execute(self):
with mock.patch('anki.storage.Collection') as anki_storage_Collection:
col = anki_storage_Collection.return_value
func = MagicMock()
func.return_value = sentinel.some_object
# check that execute works and auto-creates the collection
wrapper = CollectionWrapper(self.collection_path)
ret = wrapper.execute(func, [1, 2, 3], {'key': 'aoeu'})
self.assertEqual(ret, sentinel.some_object)
anki_storage_Collection.assert_called_with(self.collection_path)
func.assert_called_with(col, 1, 2, 3, key='aoeu')
# check that execute always returns False if waitForReturn=False
func.reset_mock()
ret = wrapper.execute(func, [1, 2, 3], {'key': 'aoeu'}, waitForReturn=False)
self.assertEqual(ret, None)
func.assert_called_with(col, 1, 2, 3, key='aoeu')