Example #1
0
 def test_header_to_tmpl(self):
     '''mail.type_mail should return the given template if a template name is given as the mail header'''
     for t in conf.MAIL_TMPLS.keys():
         self._set_up_stdin('%s\n' % t)
         self.assertEqual(type_mail(), conf.MAIL_TMPLS[t])
         # Cannot use StringIO.truncate method for py3 compatibility
         sys.stdin = StringIO()
Example #2
0
 def test_body_with_endlines(self):
     '''mail.type_mail should ignore explicit line feeds'''
     expected = {'header': 'testtest', 'body': 'pimpampoom\npampampam\n'}
     vals = [
         '%s\n' % expected['header'], 
         '%s\n' % expected['body']
     ]
     self._set_up_stdin(*vals)
     self.assertEqual(type_mail(), expected)
Example #3
0
 def test_body(self):
     '''mail.type_mail should return a well formed dict when given valid input'''
     expected = {'header': 'testtest', 'body': 'pimpampoom\n'}
     vals = [
         '%s\n' % expected['header'], 
         '%s\n' % expected['body']
     ]
     self._set_up_stdin(*vals)
     self.assertEqual(type_mail(), expected)
Example #4
0
 def test_no_header(self):
     '''mail.type_mail should return None if no header is given'''
     self._set_up_stdin('\n')
     self.assertEqual(type_mail(), None)