mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	fix label tests
This commit is contained in:
		@@ -35,6 +35,12 @@ class LabelConfig(AppConfig):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if canAppAccessDatabase():
 | 
					        if canAppAccessDatabase():
 | 
				
			||||||
 | 
					            self.create_labels()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def create_labels(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Create all default templates
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
        self.create_stock_item_labels()
 | 
					        self.create_stock_item_labels()
 | 
				
			||||||
        self.create_stock_location_labels()
 | 
					        self.create_stock_location_labels()
 | 
				
			||||||
        self.create_part_labels()
 | 
					        self.create_part_labels()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user