Ticket #25493: 25493-test.diff

File 25493-test.diff, 1.1 KB (added by Tim Graham, 9 years ago)
  • tests/expressions/tests.py

    diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
    index 1af0b6e..c44eb72 100644
    a b from django.db.models.expressions import (  
    1717from django.db.models.functions import (
    1818    Coalesce, Concat, Length, Lower, Substr, Upper,
    1919)
    20 from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
     20from django.test import TestCase, mock, skipIfDBFeature, skipUnlessDBFeature
    2121from django.test.utils import Approximate
    2222from django.utils import six
    2323from django.utils.timezone import utc
    class BasicExpressionsTests(TestCase):  
    315315        )
    316316        self.assertRaisesMessage(ValueError, msg, acme.save)
    317317
     318    def test_insert_mock(self):
     319        acme = Company.objects.create(
     320            name="The Acme Widget Co.",
     321            num_employees=mock.MagicMock(return_value=12),
     322            num_chairs=5,
     323            ceo=Employee.objects.latest('id'),
     324        )
     325
    318326    def test_ticket_11722_iexact_lookup(self):
    319327        Employee.objects.create(firstname="John", lastname="Doe")
    320328        Employee.objects.create(firstname="Test", lastname="test")
Back to Top