Eu tenho uma tabela Seller.
https://github.com/rg3915/django-experience/blob/master/djexperience/crm/models.py#L109-L118
class Seller(Employee):
objects = SellerManager()
class Meta:
proxy = True
verbose_name = 'vendedor'
verbose_name_plural = 'vendedores'
def __str__(self):
return self.username
Ela é um proxy models.
Quando rodei o test_model_seller
https://github.com/rg3915/django-experience/blob/master/djexperience/crm/tests/test_model_seller.py
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
retornou o seguinte erro:
$ 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'...
Será que o teste não se aplica a proxy models?