示例#1
0
 def test_digest_rendering(self):
     send_digest(earliest=1, latest=-1)
     outbox = Outbox.objects.all()
     for o in outbox:
         message = pickle.loads(o.message)
         # The outbox ontains email messages
         self.assertTrue('[Seabirds.net]' in message.subject)
         self.assertTrue('long enough' in message.body, msg=message.body)
示例#2
0
 def test_digest(self):
     """Test that messages are sent to the digest"""
     send_digest(earliest=1, latest=-1)
     outbox = Outbox.objects.all()
     self.assertEqual(len(outbox), len(self.subscribers))
     for o in outbox:
         message = pickle.loads(o.message)
         # The outbox contains email messages
         self.assertTrue(type(message) == EmailMessage)
         # Every outbox user is in the list of subscribers
         self.assertTrue(o.user in self.subscribers)
示例#3
0
 def test_not_twice(self):
     """Test that messages are not sent multiple times"""
     send_digest(earliest=1, latest=-1)
     send_digest(earliest=1, latest=-1)
     send_digest(earliest=1, latest=-1)
     outbox = Outbox.objects.all()
     self.assertEqual(len(outbox), len(self.subscribers))
示例#4
0
 def test_no_messages(self):
     """Test that nothing is sent if there are no messages that were made in the
         time period"""
     send_digest(earliest=10, latest=1)
     self.assertTrue(len(Outbox.objects.all()) == 0)