mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Splits tests for the tasks into their own classes
This commit is contained in:
		| @@ -18,7 +18,7 @@ from documents.tests.utils import DirectoriesMixin | |||||||
| from PIL import Image | from PIL import Image | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestTasks(DirectoriesMixin, TestCase): | class TestIndexReindex(DirectoriesMixin, TestCase): | ||||||
|     def test_index_reindex(self): |     def test_index_reindex(self): | ||||||
|         Document.objects.create( |         Document.objects.create( | ||||||
|             title="test", |             title="test", | ||||||
| @@ -43,6 +43,8 @@ class TestTasks(DirectoriesMixin, TestCase): | |||||||
|  |  | ||||||
|         tasks.index_optimize() |         tasks.index_optimize() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TestClassifier(DirectoriesMixin, TestCase): | ||||||
|     @mock.patch("documents.tasks.load_classifier") |     @mock.patch("documents.tasks.load_classifier") | ||||||
|     def test_train_classifier_no_auto_matching(self, load_classifier): |     def test_train_classifier_no_auto_matching(self, load_classifier): | ||||||
|         tasks.train_classifier() |         tasks.train_classifier() | ||||||
| @@ -93,6 +95,8 @@ class TestTasks(DirectoriesMixin, TestCase): | |||||||
|         mtime3 = os.stat(settings.MODEL_FILE).st_mtime |         mtime3 = os.stat(settings.MODEL_FILE).st_mtime | ||||||
|         self.assertNotEqual(mtime2, mtime3) |         self.assertNotEqual(mtime2, mtime3) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TestBarcode(DirectoriesMixin, TestCase): | ||||||
|     def test_barcode_reader(self): |     def test_barcode_reader(self): | ||||||
|         test_file = os.path.join( |         test_file = os.path.join( | ||||||
|             os.path.dirname(__file__), |             os.path.dirname(__file__), | ||||||
| @@ -529,6 +533,8 @@ class TestTasks(DirectoriesMixin, TestCase): | |||||||
|  |  | ||||||
|         self.assertEqual(tasks.consume_file(dst), "File successfully split") |         self.assertEqual(tasks.consume_file(dst), "File successfully split") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TestSanityCheck(DirectoriesMixin, TestCase): | ||||||
|     @mock.patch("documents.tasks.sanity_checker.check_sanity") |     @mock.patch("documents.tasks.sanity_checker.check_sanity") | ||||||
|     def test_sanity_check_success(self, m): |     def test_sanity_check_success(self, m): | ||||||
|         m.return_value = SanityCheckMessages() |         m.return_value = SanityCheckMessages() | ||||||
| @@ -565,6 +571,8 @@ class TestTasks(DirectoriesMixin, TestCase): | |||||||
|         ) |         ) | ||||||
|         m.assert_called_once() |         m.assert_called_once() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TestBulkUpdate(DirectoriesMixin, TestCase): | ||||||
|     def test_bulk_update_documents(self): |     def test_bulk_update_documents(self): | ||||||
|         doc1 = Document.objects.create( |         doc1 = Document.objects.create( | ||||||
|             title="test", |             title="test", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Trenton Holmes
					Trenton Holmes