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 rounded the 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(
occupation=self.occupation,
**EMPLOYEE_DICT)
def test_create(self):
self.assertTrue(Seller.objects.exists())
def test_created(self):
''' Seller must have an auto created attr. '''
self.assertIsInstance(self.obj.created, datetime)
This file has been truncated. show original
returned the following error:
$ m test
Creating test database for alias 'default'...
...........F......
======================================================================
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/test_model_seller.py", line 16, in test_create
self.assertTrue(Seller.objects.exists())
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 ?