2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

fix label tests

This commit is contained in:
Matthias 2022-02-13 21:15:40 +01:00
parent b49d46af58
commit a6621a5327
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 16 additions and 7 deletions

View File

@ -35,9 +35,15 @@ class LabelConfig(AppConfig):
""" """
if canAppAccessDatabase(): if canAppAccessDatabase():
self.create_stock_item_labels() self.create_labels()
self.create_stock_location_labels()
self.create_part_labels() def create_labels(self):
"""
Create all default templates
"""
self.create_stock_item_labels()
self.create_stock_location_labels()
self.create_part_labels()
def create_stock_item_labels(self): def create_stock_item_labels(self):
""" """

View File

@ -7,6 +7,7 @@ import os
from django.test import TestCase from django.test import TestCase
from django.conf import settings from django.conf import settings
from django.apps import apps
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from InvenTree.helpers import validateFilterString from InvenTree.helpers import validateFilterString
@ -17,8 +18,11 @@ from stock.models import StockItem
class LabelTest(TestCase): class LabelTest(TestCase):
# TODO - Implement this test properly. Looks like apps.py is not run first def setUp(self) -> None:
def _test_default_labels(self): # ensure the labels were created
apps.get_app_config('label').create_labels()
def test_default_labels(self):
""" """
Test that the default label templates are copied across Test that the default label templates are copied across
""" """
@ -31,8 +35,7 @@ class LabelTest(TestCase):
self.assertTrue(labels.count() > 0) self.assertTrue(labels.count() > 0)
# TODO - Implement this test properly. Looks like apps.py is not run first def test_default_files(self):
def _test_default_files(self):
""" """
Test that label files exist in the MEDIA directory Test that label files exist in the MEDIA directory
""" """