class TestUnboundPigeons(TestCase): def setUp(self): self.users, self.staff, _, _ = create_fixtures(create_message=False) self.news = AggregateNews(news_bit='Bob is a great guy.') self.news.save() self.bob = User.objects.get(first_name__iexact='bob') def test_send(self): pigeonpost_queue.send(sender=AggregateNews, send_to=self.bob) process_queue() messages = Outbox.objects.all() self.assertEqual(len(messages),1) self.assertEqual(messages[0].user, self.bob) def test_double_send(self): pigeonpost_queue.send(sender=AggregateNews, send_to=self.bob) process_queue() messages = Outbox.objects.all() self.assertEqual(len(messages),1) self.assertEqual(messages[0].user, self.bob) pigeonpost_queue.send(sender=AggregateNews, send_to=self.bob) process_queue() messages = Outbox.objects.all() self.assertEqual(len(messages),2) self.assertEqual(messages[1].user, self.bob)
def setUp(self): self.users, self.staff, _, _ = create_fixtures(create_message=False) self.news = AggregateNews(news_bit='Bob is a great guy.') self.news.save() self.bob = User.objects.get(first_name__iexact='bob')