mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	fix label tests
This commit is contained in:
		| @@ -35,9 +35,15 @@ class LabelConfig(AppConfig): | ||||
|         """ | ||||
|  | ||||
|         if canAppAccessDatabase(): | ||||
|             self.create_stock_item_labels() | ||||
|             self.create_stock_location_labels() | ||||
|             self.create_part_labels() | ||||
|             self.create_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): | ||||
|         """ | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import os | ||||
|  | ||||
| from django.test import TestCase | ||||
| from django.conf import settings | ||||
| from django.apps import apps | ||||
| from django.core.exceptions import ValidationError | ||||
|  | ||||
| from InvenTree.helpers import validateFilterString | ||||
| @@ -17,8 +18,11 @@ from stock.models import StockItem | ||||
|  | ||||
| class LabelTest(TestCase): | ||||
|  | ||||
|     # TODO - Implement this test properly. Looks like apps.py is not run first | ||||
|     def _test_default_labels(self): | ||||
|     def setUp(self) -> None: | ||||
|         # 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 | ||||
|         """ | ||||
| @@ -31,8 +35,7 @@ class LabelTest(TestCase): | ||||
|  | ||||
|         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 | ||||
|         """ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user