Error running tests with proxy models in Django


I have a Seller table.

class Seller(Employee):
objects = SellerManager()

class Meta:
    proxy = True
    verbose_name = 'vendedor'
    verbose_name_plural = 'vendedores'

def __str__(self):
    return self.username

She is a proxy models .

When I ran test_model_seller

from datetime import datetime
from django.test import TestCase
from djexperience.crm.models import Seller, Occupation
from .data import EMPLOYEE_DICT

class SellerTest(TestCase):

    def setUp(self):
        self.occupation = Occupation.objects.create(occupation='Gerente')
        self.obj = Seller.objects.create(

    def test_create(self):

    def test_created(self):
        ''' Seller must have an auto created attr. '''
        self.assertIsInstance(self.obj.created, datetime)

This file has been truncated. original show

returned the following error:

$ m test
Creating test database for alias 'default'...
FAIL: test_create (djexperience.crm.tests.test_model_seller.SellerTest)
Traceback (most recent call last):
  File "/home/rg3915/gh/my/django-experience/djexperience/crm/tests/", line 16, in test_create
AssertionError: False is not true

Ran 18 tests in 0.935s

FAILED (failures=1)
Destroying test database for alias 'default'...

Does the test not apply to proxy models ?


"Your SellerManager only returns sellers and in testing you are creating a manager."

Switching to seller solves the problem.

Scroll to Top