Beispiel #1
0
 def test_emails(self):
     story1 = create_story(title="Test Story 1", summary="Test Summary",
                               byline="Test Byline", status='draft',
                               author=self.user)
     story2 = create_story(title="Test Story 2", summary="Test Summary",
                               byline="Test Byline", status='draft',
                               author=self.user)
     story3 = create_story(title="Test Story 3", summary="Test Summary",
                               byline="Test Byline", status='draft',
                               author=self.user)
     qs = StoryNotificationQuerySet(model=StoryNotification)
     emails = qs.order_by('story__created').emails()
     self.assertEqual(len(emails), 3)
     self.assertIn(story1.title, emails[1].body)
Beispiel #2
0
 def test_ready_to_send(self):
     story1 = create_story(title="Test Story 1", summary="Test Summary",
                               byline="Test Byline", status='draft',
                               author=self.user)
     story2 = create_story(title="Test Story 2", summary="Test Summary",
                               byline="Test Byline", status='draft',
                               author=self.user)
     story3 = create_story(title="Test Story 3", summary="Test Summary",
                               byline="Test Byline", status='draft',
                               author=self.user)
     notification1 = StoryNotification.objects.get(story=story1)
     notification2 = StoryNotification.objects.get(story=story2)
     notification3 = StoryNotification.objects.get(story=story3)
     send_on = notification2.send_on
     ready_qs = StoryNotificationQuerySet(model=StoryNotification).ready_to_send(send_on)
     self.assertEqual(ready_qs.count(), 2)
     self.assertIn(notification1, ready_qs)
     self.assertIn(notification2, ready_qs)
     ready_qs = StoryNotificationQuerySet(model=StoryNotification).ready_to_send()
     self.assertEqual(ready_qs.count(), 0)
Beispiel #3
0
 def test_emails(self):
     story1 = create_story(title="Test Story 1",
                           summary="Test Summary",
                           byline="Test Byline",
                           status='draft',
                           author=self.user)
     story2 = create_story(title="Test Story 2",
                           summary="Test Summary",
                           byline="Test Byline",
                           status='draft',
                           author=self.user)
     story3 = create_story(title="Test Story 3",
                           summary="Test Summary",
                           byline="Test Byline",
                           status='draft',
                           author=self.user)
     qs = StoryNotificationQuerySet(model=StoryNotification)
     emails = qs.order_by('story__created').emails()
     self.assertEqual(len(emails), 3)
     self.assertIn(story1.title, emails[1].body)
Beispiel #4
0
 def test_ready_to_send(self):
     story1 = create_story(title="Test Story 1",
                           summary="Test Summary",
                           byline="Test Byline",
                           status='draft',
                           author=self.user)
     story2 = create_story(title="Test Story 2",
                           summary="Test Summary",
                           byline="Test Byline",
                           status='draft',
                           author=self.user)
     story3 = create_story(title="Test Story 3",
                           summary="Test Summary",
                           byline="Test Byline",
                           status='draft',
                           author=self.user)
     notification1 = StoryNotification.objects.get(story=story1)
     notification2 = StoryNotification.objects.get(story=story2)
     notification3 = StoryNotification.objects.get(story=story3)
     send_on = notification2.send_on
     ready_qs = StoryNotificationQuerySet(
         model=StoryNotification).ready_to_send(send_on)
     self.assertEqual(ready_qs.count(), 2)
     self.assertIn(notification1, ready_qs)
     self.assertIn(notification2, ready_qs)
     ready_qs = StoryNotificationQuerySet(
         model=StoryNotification).ready_to_send()
     self.assertEqual(ready_qs.count(), 0)