Пример #1
0
def test_delete_all_failure():
    view = TestDataModelRestView()
    view.model = Mock()
    view.model.objects.all().delete.side_effect = Exception
    assert_equal(view.delete(None), False)
    view.model.objects.all().delete.assert_called_once_with()
Пример #2
0
def test_delete_all():
    view = TestDataModelRestView()
    view.model = Mock()
    view.model.objects.all().count.return_value = 4
    assert_equal(view.delete(None), 4)
    view.model.objects.all().delete.assert_called_once_with()