tests + migration file updated

This commit is contained in:
mathiasag7 2024-03-22 15:55:01 +01:00
parent 2ff929281a
commit 3b8d28c49e
3 changed files with 6 additions and 4 deletions

View file

@ -45,4 +45,4 @@ class Migration(migrations.Migration):
serialize=False,
),
),
]
]

View file

@ -35,17 +35,18 @@ class AttributeTestCase(TestCase):
class ValueModelTestCase(TestCase):
def setUp(self):
eav.register(User)
self.attribute = Attribute.objects.create(name='Test Attribute', datatype=Attribute.TYPE_TEXT, slug="test_attribute")
self.attribute = Attribute.objects.create(
name='Test Attribute', datatype=Attribute.TYPE_TEXT, slug="test_attribute"
)
self.user = User.objects.create(username='crazy_dev_user')
user_content_type = ContentType.objects.get_for_model(User)
self.value = Value.objects.create(
entity_id=self.user.id,
entity_ct=user_content_type,
value_text='Test Value',
attribute=self.attribute
attribute=self.attribute,
)
def test_value_str(self):
expected_str = f'{self.attribute.name}: "{self.value.value_text}" ({self.value.entity_pk_int})'
self.assertEqual(str(self.value), expected_str)

View file

@ -3,6 +3,7 @@ from django.forms import Textarea
from django.test import TestCase
from eav.widgets import CSVWidget
class TestCSVWidget(TestCase):
def test_prep_value_string(self):
self._extracted_from_test_prep_value_empty_2("Test Value")