From a22f088e28335b4bb33e9226fbb460b4b24086e7 Mon Sep 17 00:00:00 2001 From: Tikitu de Jager Date: Mon, 7 Mar 2016 21:48:47 +0200 Subject: [PATCH] Add some failing edge case tests --- src/documents/tests/test_consumer.py | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/documents/tests/test_consumer.py b/src/documents/tests/test_consumer.py index 37d765ac7..634e8c4f0 100644 --- a/src/documents/tests/test_consumer.py +++ b/src/documents/tests/test_consumer.py @@ -92,6 +92,38 @@ class TestAttachment(TestCase): self.TAGS ) + def test_guess_attributes_from_name_when_correspondent_empty(self): + self._test_guess_attributes_from_name( + '/path/to/ - weird empty correspondent but should not break.{}', + None, + ' - weird empty correspondent but should not break', + () + ) + + def test_guess_attributes_from_name_when_title_starts_with_dash(self): + self._test_guess_attributes_from_name( + '/path/to/- weird but should not break.{}', + None, + '- weird but should not break', + () + ) + + def test_guess_attributes_from_name_when_title_ends_with_dash(self): + self._test_guess_attributes_from_name( + '/path/to/weird but should not break -.{}', + None, + 'weird but should not break -', + () + ) + + def test_guess_attributes_from_name_when_title_is_empty(self): + self._test_guess_attributes_from_name( + '/path/to/weird correspondent but should not break - .{}', + 'weird correspondent but should not break', + '', + () + ) + class Permutations(TestCase): valid_correspondents = ['timmy', 'Dr. McWheelie',