def test_delete_legit(self, mock_db): delete_one = mock_db.__getitem__.return_value.delete_one delete_one.return_value = True doc = Document(_id='foo') doc.delete() assert doc._id is None delete_one.assert_called_once_with({'_id': 'foo'}, session=None)
def test_delete_unknow(self): doc = Document(collection='test') assert doc.delete() is None