Exemplo n.º 1
0
 def test_invoke_should_handle_unicode_chars(self):
     date = datetime(2014, 2, 16, 12, 34)
     mail = Mail(subject=u'Test\u0131',
                 sender='*****@*****.**',
                 guid='1234567',
                 datetime=date)
     mock_session = Mock(get_email_list=lambda: [mail])
     output = self.command.invoke(mock_session, None)
     expect(output).to.equal(
         u'(*) 1234567   12:34:00  [email protected]\nTest\u0131\n\n')
Exemplo n.º 2
0
 def test_invoke_should_format_mail_summaries_with_left_aligned_guid(self):
     date = datetime(2014, 2, 16, 12, 34)
     mail = Mail(subject='Test',
                 sender='*****@*****.**',
                 guid='123',
                 datetime=date)
     mock_session = Mock(get_email_list=lambda: [mail])
     output = self.command.invoke(mock_session, None)
     expect(output).to.equal(
         '(*) 123       12:34:00  [email protected]\nTest\n\n')
Exemplo n.º 3
0
 def test_invoke_should_format_mail(self):
     mail = Mail(subject='Test',
                 sender='*****@*****.**',
                 datetime=datetime(2014, 2, 15, 22, 2, 29),
                 body='Hello')
     mock_session = Mock(get_email=lambda _: mail)
     mock_args = Mock(id=1)
     output = self.command.invoke(mock_session, mock_args)
     expect(output).to.equal(
         'From: [email protected]\nDate: {0}\nSubject: Test\n\nHello\n'.
         format(mail.datetime))
Exemplo n.º 4
0
 def test_invoke_should_format_mail_summaries_with_tz_when_present(self):
     date = datetime(2014, 2, 16, 12, 34, tzinfo=utc)
     mail = Mail(subject='Test',
                 sender='*****@*****.**',
                 guid='1234567',
                 datetime=date,
                 read=True)
     mock_session = Mock(get_email_list=lambda: [mail])
     output = self.command.invoke(mock_session, None)
     expect(output).to.equal(
         '( ) 1234567   12:34:00+00:00  [email protected]\nTest\n\n')
Exemplo n.º 5
0
 def test_time_should_be_none_when_datetime_is_none(self):
     mail = Mail(datetime=None)
     expect(mail.time).to.be.none
Exemplo n.º 6
0
 def test_time_should_be_use_same_tz_as_datetime(self):
     mail = Mail(datetime=datetime(2014, 2, 16, 19, 34, tzinfo=utc))
     expect(mail.time).to.equal(time(19, 34, tzinfo=utc))
Exemplo n.º 7
0
 def test_time_should_be_derived_from_datetime(self):
     mail = Mail(datetime=datetime(2014, 2, 16, 19, 34))
     expect(mail.time).to.equal(time(19, 34))