mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Further fixes for unit tests
This commit is contained in:
parent
d9e1302eaf
commit
baab955756
@ -62,20 +62,20 @@ class BuildTest(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Create BOM item links for the parts
|
# Create BOM item links for the parts
|
||||||
BomItem.objects.create(
|
self.bom_item_1 = BomItem.objects.create(
|
||||||
part=self.assembly,
|
part=self.assembly,
|
||||||
sub_part=self.sub_part_1,
|
sub_part=self.sub_part_1,
|
||||||
quantity=5
|
quantity=5
|
||||||
)
|
)
|
||||||
|
|
||||||
BomItem.objects.create(
|
self.bom_item_2 = BomItem.objects.create(
|
||||||
part=self.assembly,
|
part=self.assembly,
|
||||||
sub_part=self.sub_part_2,
|
sub_part=self.sub_part_2,
|
||||||
quantity=3
|
quantity=3
|
||||||
)
|
)
|
||||||
|
|
||||||
# sub_part_3 is trackable!
|
# sub_part_3 is trackable!
|
||||||
BomItem.objects.create(
|
self.bom_item_3 = BomItem.objects.create(
|
||||||
part=self.assembly,
|
part=self.assembly,
|
||||||
sub_part=self.sub_part_3,
|
sub_part=self.sub_part_3,
|
||||||
quantity=2
|
quantity=2
|
||||||
@ -149,13 +149,13 @@ class BuildTest(TestCase):
|
|||||||
for output in self.build.get_build_outputs().all():
|
for output in self.build.get_build_outputs().all():
|
||||||
self.assertFalse(self.build.is_fully_allocated(output))
|
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.bom_item_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_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.bom_item_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.bom_item_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.bom_item_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_2, self.output_2), 21)
|
||||||
|
|
||||||
self.assertFalse(self.build.is_complete)
|
self.assertFalse(self.build.is_complete)
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Generated by Django 3.0.7 on 2020-11-10 11:25
|
# Generated by Django 3.0.7 on 2020-11-10 11:25
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
from moneyed import CURRENCIES
|
from moneyed import CURRENCIES
|
||||||
@ -7,6 +9,9 @@ from django.db import migrations, connection
|
|||||||
from company.models import SupplierPriceBreak
|
from company.models import SupplierPriceBreak
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger('inventree')
|
||||||
|
|
||||||
|
|
||||||
def migrate_currencies(apps, schema_editor):
|
def migrate_currencies(apps, schema_editor):
|
||||||
"""
|
"""
|
||||||
Migrate from the 'old' method of handling currencies,
|
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.
|
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
|
# A list of available currency codes
|
||||||
currency_codes = CURRENCIES.keys()
|
currency_codes = CURRENCIES.keys()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user