Further fixes for unit tests

This commit is contained in:
Oliver 2022-02-25 17:17:34 +11:00
parent d9e1302eaf
commit baab955756
2 changed files with 15 additions and 10 deletions

View File

@ -62,20 +62,20 @@ class BuildTest(TestCase):
)
# Create BOM item links for the parts
BomItem.objects.create(
self.bom_item_1 = BomItem.objects.create(
part=self.assembly,
sub_part=self.sub_part_1,
quantity=5
)
BomItem.objects.create(
self.bom_item_2 = BomItem.objects.create(
part=self.assembly,
sub_part=self.sub_part_2,
quantity=3
)
# sub_part_3 is trackable!
BomItem.objects.create(
self.bom_item_3 = BomItem.objects.create(
part=self.assembly,
sub_part=self.sub_part_3,
quantity=2
@ -149,13 +149,13 @@ class BuildTest(TestCase):
for output in self.build.get_build_outputs().all():
self.assertFalse(self.build.is_fully_allocated(output))
self.assertFalse(self.build.is_bom_item_allocated(self.sub_part_1, self.output_1))
self.assertFalse(self.build.is_bom_item_allocated(self.sub_part_2, self.output_2))
self.assertFalse(self.build.is_bom_item_allocated(self.bom_item_1, self.output_1))
self.assertFalse(self.build.is_bom_item_allocated(self.bom_item_2, self.output_2))
self.assertEqual(self.build.unallocated_quantity(self.sub_part_1, self.output_1), 15)
self.assertEqual(self.build.unallocated_quantity(self.sub_part_1, self.output_2), 35)
self.assertEqual(self.build.unallocated_quantity(self.sub_part_2, self.output_1), 9)
self.assertEqual(self.build.unallocated_quantity(self.sub_part_2, self.output_2), 21)
self.assertEqual(self.build.unallocated_quantity(self.bom_item_1, self.output_1), 15)
self.assertEqual(self.build.unallocated_quantity(self.bom_item_1, self.output_2), 35)
self.assertEqual(self.build.unallocated_quantity(self.bom_item_2, self.output_1), 9)
self.assertEqual(self.build.unallocated_quantity(self.bom_item_2, self.output_2), 21)
self.assertFalse(self.build.is_complete)

View File

@ -1,5 +1,7 @@
# Generated by Django 3.0.7 on 2020-11-10 11:25
import logging
from django.db import migrations
from moneyed import CURRENCIES
@ -7,6 +9,9 @@ from django.db import migrations, connection
from company.models import SupplierPriceBreak
logger = logging.getLogger('inventree')
def migrate_currencies(apps, schema_editor):
"""
Migrate from the 'old' method of handling currencies,
@ -19,7 +24,7 @@ def migrate_currencies(apps, schema_editor):
for the SupplierPriceBreak model, to a new django-money compatible currency.
"""
print("Updating currency references for SupplierPriceBreak model...")
logger.info("Updating currency references for SupplierPriceBreak model...")
# A list of available currency codes
currency_codes = CURRENCIES.keys()