mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-10 00:18:57 +00:00
Fix log matches related to newlines, add newlines to stdout.writelines
This commit is contained in:
@@ -87,7 +87,7 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
filename="other_test.pdf",
|
||||
)
|
||||
stdout, _ = self.call_command()
|
||||
self.assertEqual(stdout, "No matches found\n")
|
||||
self.assertIn("No matches found", stdout)
|
||||
|
||||
def test_with_matches(self):
|
||||
"""
|
||||
@@ -116,7 +116,7 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
filename="other_test.pdf",
|
||||
)
|
||||
stdout, _ = self.call_command("--processes", "1")
|
||||
self.assertRegex(stdout, self.MSG_REGEX + "\n")
|
||||
self.assertRegex(stdout, self.MSG_REGEX)
|
||||
|
||||
def test_with_3_matches(self):
|
||||
"""
|
||||
@@ -152,11 +152,10 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
filename="final_test.pdf",
|
||||
)
|
||||
stdout, _ = self.call_command()
|
||||
lines = [x.strip() for x in stdout.split("\n") if len(x.strip())]
|
||||
lines = [x.strip() for x in stdout.splitlines() if x.strip()]
|
||||
self.assertEqual(len(lines), 3)
|
||||
self.assertRegex(lines[0], self.MSG_REGEX)
|
||||
self.assertRegex(lines[1], self.MSG_REGEX)
|
||||
self.assertRegex(lines[2], self.MSG_REGEX)
|
||||
for line in lines:
|
||||
self.assertRegex(line, self.MSG_REGEX)
|
||||
|
||||
def test_document_deletion(self):
|
||||
"""
|
||||
@@ -197,14 +196,12 @@ class TestFuzzyMatchCommand(TestCase):
|
||||
|
||||
stdout, _ = self.call_command("--delete")
|
||||
|
||||
lines = [x.strip() for x in stdout.split("\n") if len(x.strip())]
|
||||
self.assertEqual(len(lines), 3)
|
||||
self.assertEqual(
|
||||
lines[0],
|
||||
self.assertIn(
|
||||
"The command is configured to delete documents. Use with caution",
|
||||
stdout,
|
||||
)
|
||||
self.assertRegex(lines[1], self.MSG_REGEX)
|
||||
self.assertEqual(lines[2], "Deleting 1 documents based on ratio matches")
|
||||
self.assertRegex(stdout, self.MSG_REGEX)
|
||||
self.assertIn("Deleting 1 documents based on ratio matches", stdout)
|
||||
|
||||
self.assertEqual(Document.objects.count(), 2)
|
||||
self.assertIsNotNone(Document.objects.get(pk=1))
|
||||
|
Reference in New Issue
Block a user