def test_project_with_regex(self): self.email['Subject'] = '[PATCH PROJECT X subsystem]' project = find_project(self.email) self.assertEqual(project, self.project_x) self.email['Subject'] = '[PATCH PROJECTX another subsystem]' project = find_project(self.email) self.assertEqual(project, self.project_x)
def test_default_project(self): self.email['Subject'] = '[PATCH unknown project]' project = find_project(self.email) self.assertEqual(project, self.default_project) self.email['Subject'] = '[PATCH NOT-PROJECT-X]' project = find_project(self.email) self.assertEqual(project, self.default_project)
def test_short_list_id(self): """Some mailing lists have List-Id headers in short formats, where it is only the list ID itself (without enclosing angle-brackets). """ email = MIMEText('') email['List-Id'] = self.project.listid project = find_project(email) self.assertEqual(project, self.project)
def test_long_list_id(self): email = MIMEText('') email['List-Id'] = 'Test text <%s>' % self.project.listid project = find_project(email) self.assertEqual(project, self.project)
def test_substring_list_id(self): email = MIMEText('') email['List-Id'] = 'example.com' project = find_project(email) self.assertEqual(project, None)
def test_whitespace_list_id(self): email = MIMEText('') email['List-Id'] = ' ' project = find_project(email) self.assertEqual(project, None)
def test_nonexistent_project(self): project = find_project(self.email_no_project) self.assertEqual(project, None)
def test_project_with_keyword(self): self.email['Subject'] = '[PATCH keyword] subsystem' project = find_project(self.email) self.assertEqual(project, self.keyword_project)
def test_list_id_override(self): project = find_project(self.email_no_project, self.keyword_project.listid) self.assertEqual(project, self.keyword_project)
def test_no_list_id(self): email = MIMEText('') project = find_project(email) self.assertEqual(project, None)