Пример #1
0
    def test_triggers_a_viewed_signal(self):
        # Setup
        forum_url, link_url = (self.top_level_forum.get_absolute_url(),
                               self.top_level_link.get_absolute_url())

        # Run & check
        for url in [forum_url, link_url]:
            with mock_signal_receiver(forum_viewed) as receiver:
                self.client.get(url)
                assert receiver.call_count == 1
Пример #2
0
 def test_can_send_a_specific_signal_when_a_forum_is_moved(self):
     # Setup
     topic = create_topic(forum=self.top_level_forum, poster=self.u1)
     PostFactory.create(topic=topic, poster=self.u1)
     PostFactory.create(topic=topic, poster=self.u1)
     # Run & check
     with mock_signal_receiver(forum_moved) as receiver:
         self.top_level_forum.parent = self.top_level_cat
         self.top_level_forum.save()
         assert receiver.call_count == 1
Пример #3
0
    def test_triggers_a_viewed_signal(self):
        # Setup
        forum_url, link_url = (self.top_level_forum.get_absolute_url(),
                               self.top_level_link.get_absolute_url())

        # Run & check
        for url in [forum_url, link_url]:
            with mock_signal_receiver(forum_viewed) as receiver:
                self.client.get(url)
                assert receiver.call_count == 1
Пример #4
0
 def test_can_send_a_specific_signal_when_a_forum_is_moved(self):
     # Setup
     topic = create_topic(forum=self.top_level_forum, poster=self.u1)
     PostFactory.create(topic=topic, poster=self.u1)
     PostFactory.create(topic=topic, poster=self.u1)
     # Run & check
     with mock_signal_receiver(forum_moved) as receiver:
         self.top_level_forum.parent = self.top_level_cat
         self.top_level_forum.save()
         assert receiver.call_count == 1
Пример #5
0
    def test_triggers_a_viewed_signal(self):
        # Setup
        forum_url = reverse('forum:forum', kwargs={
            'slug': self.top_level_forum.slug, 'pk': self.top_level_forum.id})
        link_url = reverse('forum:forum', kwargs={
            'slug': self.top_level_link.slug, 'pk': self.top_level_link.id})

        # Run & check
        for url in [forum_url, link_url]:
            with mock_signal_receiver(forum_viewed) as receiver:
                self.client.get(url)
                assert receiver.call_count == 1
Пример #6
0
    def test_triggers_a_viewed_signal(self):
        # Setup
        forum_url = reverse('forum:forum', kwargs={
            'slug': self.top_level_forum.slug, 'pk': self.top_level_forum.id})
        link_url = reverse('forum:forum', kwargs={
            'slug': self.top_level_link.slug, 'pk': self.top_level_link.id})

        # Run & check
        for url in [forum_url, link_url]:
            with mock_signal_receiver(forum_viewed) as receiver:
                self.client.get(url)
                assert receiver.call_count == 1