Exemplo n.º 1
0
    def test_doesnt_insert_unsaved_object(self, backend):
        obj = models.Book(title="Test",
                          publication_date=date(2017, 10, 18),
                          number_of_pages=100)
        backend().reset_mock()

        index.insert_or_update_object(obj)

        self.assertFalse(backend().add.mock_calls)
Exemplo n.º 2
0
    def test_removes_unsaved_object(self, backend):
        obj = models.Book(title="Test",
                          publication_date=date(2017, 10, 18),
                          number_of_pages=100)
        backend().reset_mock()

        index.remove_object(obj)

        backend().delete.assert_called_with(obj)