コード例 #1
0
ファイル: test_mail.py プロジェクト: raphigaziano/sendcrap
 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()
コード例 #2
0
ファイル: test_mail.py プロジェクト: raphigaziano/sendcrap
 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)
コード例 #3
0
ファイル: test_mail.py プロジェクト: raphigaziano/sendcrap
 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)
コード例 #4
0
ファイル: test_mail.py プロジェクト: raphigaziano/sendcrap
 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)