mirror of
https://github.com/inventree/InvenTree.git
synced 2026-03-15 16:40:56 +00:00
Fix unit test for data migration
This commit is contained in:
@@ -340,13 +340,19 @@ class TestPartParameterDeletion(MigratorTestCase):
|
|||||||
ParameterTemplate = self.new_state.apps.get_model('common', 'parametertemplate')
|
ParameterTemplate = self.new_state.apps.get_model('common', 'parametertemplate')
|
||||||
Parameter = self.new_state.apps.get_model('common', 'parameter')
|
Parameter = self.new_state.apps.get_model('common', 'parameter')
|
||||||
Part = self.new_state.apps.get_model('part', 'part')
|
Part = self.new_state.apps.get_model('part', 'part')
|
||||||
|
ContentType = self.new_state.apps.get_model('contenttypes', 'contenttype')
|
||||||
|
|
||||||
self.assertEqual(ParameterTemplate.objects.count(), 3)
|
self.assertEqual(ParameterTemplate.objects.count(), 3)
|
||||||
self.assertEqual(Parameter.objects.count(), 9)
|
self.assertEqual(Parameter.objects.count(), 9)
|
||||||
self.assertEqual(Part.objects.count(), 3)
|
self.assertEqual(Part.objects.count(), 3)
|
||||||
|
|
||||||
|
content_type, _created = ContentType.objects.get_or_create(
|
||||||
|
app_label='part', model='part'
|
||||||
|
)
|
||||||
|
|
||||||
for p in Part.objects.all():
|
for p in Part.objects.all():
|
||||||
params = p.parameters_list.all()
|
params = Parameter.objects.filter(model_type=content_type, model_id=p.id)
|
||||||
|
|
||||||
self.assertEqual(len(params), 3)
|
self.assertEqual(len(params), 3)
|
||||||
|
|
||||||
for unit in self.UNITS:
|
for unit in self.UNITS:
|
||||||
|
|||||||
Reference in New Issue
Block a user