mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	layout changes, removed irrelevant test cases
This commit is contained in:
		
							
								
								
									
										31
									
								
								src/documents/templates/admin/documents/document/change_list_results.html
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										31
									
								
								src/documents/templates/admin/documents/document/change_list_results.html
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							@@ -6,26 +6,29 @@
 | 
			
		||||
    -moz-box-sizing: border-box;
 | 
			
		||||
    box-sizing: border-box;
 | 
			
		||||
  }
 | 
			
		||||
  .grid {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    flex-wrap: wrap;
 | 
			
		||||
    margin: 10px 0px 10px 10px;
 | 
			
		||||
  }
 | 
			
		||||
  .box {
 | 
			
		||||
    width: 12.5%;
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    float: left;
 | 
			
		||||
    opacity: 0.7;
 | 
			
		||||
    padding-right: 10px;
 | 
			
		||||
    padding-bottom: 15px;
 | 
			
		||||
    opacity: 0.8;
 | 
			
		||||
    transition: all 0.5s;
 | 
			
		||||
  }
 | 
			
		||||
  .box:hover {
 | 
			
		||||
    opacity: 1;
 | 
			
		||||
    transition: all 0.5s;
 | 
			
		||||
  }
 | 
			
		||||
  .box:last-of-type {
 | 
			
		||||
    padding-right: 0;
 | 
			
		||||
  }
 | 
			
		||||
  .result {
 | 
			
		||||
    border: 1px solid #cccccc;
 | 
			
		||||
    border-radius: 2%;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
    height: 350px;
 | 
			
		||||
    position: relative;
 | 
			
		||||
    box-shadow: 1px 1px 4px #cccccc;
 | 
			
		||||
  }
 | 
			
		||||
  .result .header {
 | 
			
		||||
    padding: 5px;
 | 
			
		||||
@@ -95,9 +98,6 @@
 | 
			
		||||
    background: white;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .grid {
 | 
			
		||||
    margin-right: 260px;
 | 
			
		||||
  }
 | 
			
		||||
  .grid:after {
 | 
			
		||||
    content: "";
 | 
			
		||||
    display: table;
 | 
			
		||||
@@ -135,6 +135,15 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{# This is just copypasta from the parent change_list_results.html file #}
 | 
			
		||||
 | 
			
		||||
{% if result_hidden_fields %}
 | 
			
		||||
<div class="hiddenfields">{# DIV for HTML validation #}
 | 
			
		||||
{% for item in result_hidden_fields %}{{ item }}{% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if results %}
 | 
			
		||||
<div class="results">
 | 
			
		||||
<table id="result_list">
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
@@ -155,6 +164,8 @@
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
</table>
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{# /copypasta #}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -213,3 +224,5 @@
 | 
			
		||||
      .prop("checked", this.checked);
 | 
			
		||||
  });
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ var pdfDoc = null,
 | 
			
		||||
    pageNum = 1,
 | 
			
		||||
    pageRendering = false,
 | 
			
		||||
    pageNumPending = null,
 | 
			
		||||
    scale = 1.0,
 | 
			
		||||
    scale = 1.44,
 | 
			
		||||
    canvas = document.getElementById('the-canvas'),
 | 
			
		||||
    ctx = canvas.getContext('2d');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,200 +7,6 @@ from django.test import TestCase, override_settings
 | 
			
		||||
from ..models import Correspondent, Document, Tag
 | 
			
		||||
from ..signals import document_consumption_finished
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestMatching(TestCase):
 | 
			
		||||
 | 
			
		||||
    def _test_matching(self, text, algorithm, true, false):
 | 
			
		||||
        for klass in (Tag, Correspondent):
 | 
			
		||||
            instance = klass.objects.create(
 | 
			
		||||
                name=str(randint(10000, 99999)),
 | 
			
		||||
                match=text,
 | 
			
		||||
                matching_algorithm=getattr(klass, algorithm)
 | 
			
		||||
            )
 | 
			
		||||
            for string in true:
 | 
			
		||||
                self.assertTrue(
 | 
			
		||||
                    instance.matches(string),
 | 
			
		||||
                    '"%s" should match "%s" but it does not' % (text, string)
 | 
			
		||||
                )
 | 
			
		||||
            for string in false:
 | 
			
		||||
                self.assertFalse(
 | 
			
		||||
                    instance.matches(string),
 | 
			
		||||
                    '"%s" should not match "%s" but it does' % (text, string)
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
    def test_match_all(self):
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "alpha charlie gamma",
 | 
			
		||||
            "MATCH_ALL",
 | 
			
		||||
            ("I have alpha, charlie, and gamma in me",),
 | 
			
		||||
            (
 | 
			
		||||
                "I have alpha in me",
 | 
			
		||||
                "I have charlie in me",
 | 
			
		||||
                "I have gamma in me",
 | 
			
		||||
                "I have alpha and charlie in me",
 | 
			
		||||
                "I have alphas, charlie, and gamma in me",
 | 
			
		||||
                "I have alphas in me",
 | 
			
		||||
                "I have bravo in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "12 34 56",
 | 
			
		||||
            "MATCH_ALL",
 | 
			
		||||
            (
 | 
			
		||||
                "I have 12 34, and 56 in me",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "I have 12 in me",
 | 
			
		||||
                "I have 34 in me",
 | 
			
		||||
                "I have 56 in me",
 | 
			
		||||
                "I have 12 and 34 in me",
 | 
			
		||||
                "I have 120, 34, and 56 in me",
 | 
			
		||||
                "I have 123456 in me",
 | 
			
		||||
                "I have 01234567 in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            'brown fox "lazy dogs"',
 | 
			
		||||
            "MATCH_ALL",
 | 
			
		||||
            (
 | 
			
		||||
                "the quick brown fox jumped over the lazy dogs",
 | 
			
		||||
                "the quick brown fox jumped over the lazy  dogs",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "the quick fox jumped over the lazy dogs",
 | 
			
		||||
                "the quick brown wolf jumped over the lazy dogs",
 | 
			
		||||
                "the quick brown fox jumped over the fat dogs",
 | 
			
		||||
                "the quick brown fox jumped over the lazy... dogs",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_match_any(self):
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "alpha charlie gamma",
 | 
			
		||||
            "MATCH_ANY",
 | 
			
		||||
            (
 | 
			
		||||
                "I have alpha in me",
 | 
			
		||||
                "I have charlie in me",
 | 
			
		||||
                "I have gamma in me",
 | 
			
		||||
                "I have alpha, charlie, and gamma in me",
 | 
			
		||||
                "I have alpha and charlie in me",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "I have alphas in me",
 | 
			
		||||
                "I have bravo in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "12 34 56",
 | 
			
		||||
            "MATCH_ANY",
 | 
			
		||||
            (
 | 
			
		||||
                "I have 12 in me",
 | 
			
		||||
                "I have 34 in me",
 | 
			
		||||
                "I have 56 in me",
 | 
			
		||||
                "I have 12 and 34 in me",
 | 
			
		||||
                "I have 12, 34, and 56 in me",
 | 
			
		||||
                "I have 120, 34, and 56 in me",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "I have 123456 in me",
 | 
			
		||||
                "I have 01234567 in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            '"brown fox" " lazy  dogs "',
 | 
			
		||||
            "MATCH_ANY",
 | 
			
		||||
            (
 | 
			
		||||
                "the quick brown fox",
 | 
			
		||||
                "jumped over the lazy  dogs.",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "the lazy fox jumped over the brown dogs",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_match_literal(self):
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "alpha charlie gamma",
 | 
			
		||||
            "MATCH_LITERAL",
 | 
			
		||||
            (
 | 
			
		||||
                "I have 'alpha charlie gamma' in me",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "I have alpha in me",
 | 
			
		||||
                "I have charlie in me",
 | 
			
		||||
                "I have gamma in me",
 | 
			
		||||
                "I have alpha and charlie in me",
 | 
			
		||||
                "I have alpha, charlie, and gamma in me",
 | 
			
		||||
                "I have alphas, charlie, and gamma in me",
 | 
			
		||||
                "I have alphas in me",
 | 
			
		||||
                "I have bravo in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "12 34 56",
 | 
			
		||||
            "MATCH_LITERAL",
 | 
			
		||||
            (
 | 
			
		||||
                "I have 12 34 56 in me",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "I have 12 in me",
 | 
			
		||||
                "I have 34 in me",
 | 
			
		||||
                "I have 56 in me",
 | 
			
		||||
                "I have 12 and 34 in me",
 | 
			
		||||
                "I have 12 34, and 56 in me",
 | 
			
		||||
                "I have 120, 34, and 560 in me",
 | 
			
		||||
                "I have 120, 340, and 560 in me",
 | 
			
		||||
                "I have 123456 in me",
 | 
			
		||||
                "I have 01234567 in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_match_regex(self):
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            r"alpha\w+gamma",
 | 
			
		||||
            "MATCH_REGEX",
 | 
			
		||||
            (
 | 
			
		||||
                "I have alpha_and_gamma in me",
 | 
			
		||||
                "I have alphas_and_gamma in me",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "I have alpha in me",
 | 
			
		||||
                "I have gamma in me",
 | 
			
		||||
                "I have alpha and charlie in me",
 | 
			
		||||
                "I have alpha,and,gamma in me",
 | 
			
		||||
                "I have alpha and gamma in me",
 | 
			
		||||
                "I have alpha, charlie, and gamma in me",
 | 
			
		||||
                "I have alphas, charlie, and gamma in me",
 | 
			
		||||
                "I have alphas in me",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_match_fuzzy(self):
 | 
			
		||||
 | 
			
		||||
        self._test_matching(
 | 
			
		||||
            "Springfield, Miss.",
 | 
			
		||||
            "MATCH_FUZZY",
 | 
			
		||||
            (
 | 
			
		||||
                "1220 Main Street, Springf eld, Miss.",
 | 
			
		||||
                "1220 Main Street, Spring field, Miss.",
 | 
			
		||||
                "1220 Main Street, Springfeld, Miss.",
 | 
			
		||||
                "1220 Main Street Springfield Miss",
 | 
			
		||||
            ),
 | 
			
		||||
            (
 | 
			
		||||
                "1220 Main Street, Springfield, Mich.",
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@override_settings(POST_CONSUME_SCRIPT=None)
 | 
			
		||||
class TestDocumentConsumptionFinishedSignal(TestCase):
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										0
									
								
								src/paperless/settings.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								src/paperless/settings.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
		Reference in New Issue
	
	Block a user