mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	more tests
This commit is contained in:
		
							parent
							
								
									56204933b0
								
							
						
					
					
						commit
						7e0aa7136a
					
				
							
								
								
									
										1
									
								
								src/paperless_text/tests/samples/test.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/paperless_text/tests/samples/test.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
This is a test file.
 | 
			
		||||
							
								
								
									
										26
									
								
								src/paperless_text/tests/test_parser.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/paperless_text/tests/test_parser.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from django.test import TestCase
 | 
			
		||||
 | 
			
		||||
from documents.tests.utils import DirectoriesMixin
 | 
			
		||||
from paperless_text.parsers import TextDocumentParser
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestTextParser(DirectoriesMixin, TestCase):
 | 
			
		||||
 | 
			
		||||
    def test_thumbnail(self):
 | 
			
		||||
 | 
			
		||||
        parser = TextDocumentParser(None)
 | 
			
		||||
 | 
			
		||||
        # just make sure that it does not crash
 | 
			
		||||
        f = parser.get_thumbnail(os.path.join(os.path.dirname(__file__), "samples", "test.txt"), "text/plain")
 | 
			
		||||
        self.assertTrue(os.path.isfile(f))
 | 
			
		||||
 | 
			
		||||
    def test_parse(self):
 | 
			
		||||
 | 
			
		||||
        parser = TextDocumentParser(None)
 | 
			
		||||
 | 
			
		||||
        parser.parse(os.path.join(os.path.dirname(__file__), "samples", "test.txt"), "text/plain")
 | 
			
		||||
 | 
			
		||||
        self.assertEqual(parser.get_text(), "This is a test file.\n")
 | 
			
		||||
        self.assertIsNone(parser.get_archive_path())
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user