mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	update tests, remove dead code
This commit is contained in:
		| @@ -382,13 +382,6 @@ class PostDocumentSerializer(serializers.Serializer): | ||||
|  | ||||
|         return document.name, document_data | ||||
|  | ||||
|     def validate_title(self, title): | ||||
|         if title: | ||||
|             return title | ||||
|         else: | ||||
|             # do not return empty strings. | ||||
|             return None | ||||
|  | ||||
|     def validate_correspondent(self, correspondent): | ||||
|         if correspondent: | ||||
|             return correspondent.id | ||||
|   | ||||
| @@ -114,8 +114,6 @@ class TestDocumentApi(DirectoriesMixin, APITestCase): | ||||
|         results = response.data['results'] | ||||
|         self.assertEqual(len(results[0]), 0) | ||||
|  | ||||
|  | ||||
|  | ||||
|     def test_document_actions(self): | ||||
|  | ||||
|         _, filename = tempfile.mkstemp(dir=self.dirs.originals_dir) | ||||
| @@ -455,6 +453,23 @@ class TestDocumentApi(DirectoriesMixin, APITestCase): | ||||
|         self.assertIsNone(kwargs['override_document_type_id']) | ||||
|         self.assertIsNone(kwargs['override_tag_ids']) | ||||
|  | ||||
|     @mock.patch("documents.views.async_task") | ||||
|     def test_upload_empty_metadata(self, m): | ||||
|  | ||||
|         with open(os.path.join(os.path.dirname(__file__), "samples", "simple.pdf"), "rb") as f: | ||||
|             response = self.client.post("/api/documents/post_document/", {"document": f, "title": "", "correspondent": "", "document_type": ""}) | ||||
|  | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|  | ||||
|         m.assert_called_once() | ||||
|  | ||||
|         args, kwargs = m.call_args | ||||
|         self.assertEqual(kwargs['override_filename'], "simple.pdf") | ||||
|         self.assertIsNone(kwargs['override_title']) | ||||
|         self.assertIsNone(kwargs['override_correspondent_id']) | ||||
|         self.assertIsNone(kwargs['override_document_type_id']) | ||||
|         self.assertIsNone(kwargs['override_tag_ids']) | ||||
|  | ||||
|     @mock.patch("documents.views.async_task") | ||||
|     def test_upload_invalid_form(self, m): | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler