Esempio n. 1
0
 def test_plucation_dates_correspond_to_the_topic_creation_dates(self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     # Run & check
     assert feed.item_pubdate(self.topic_2) == self.topic_2.created
Esempio n. 2
0
 def test_plucation_dates_correspond_to_the_topic_creation_dates(self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     # Run & check
     assert feed.item_pubdate(self.topic_2) == self.topic_2.created
Esempio n. 3
0
 def test_can_return_all_the_topics_that_can_be_read_by_the_current_user_in_a_forum_without_its_descendants(self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     # Run
     feed.get_object(request, forum_pk=self.forum_2.pk, descendants=False)
     topics = feed.items()
     # Check
     assert list(topics) == [self.topic_2, ]
Esempio n. 4
0
 def test_can_return_all_the_topics_that_can_be_read_by_the_current_user(self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     # Run
     feed.get_object(request)
     topics = feed.items()
     # Check
     assert list(topics) == [self.topic_3, self.topic_2, self.topic_1, ]
Esempio n. 5
0
 def test_can_return_all_the_topics_that_can_be_read_by_the_current_user_in_a_forum_without_its_descendants(self):  # noqa
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     request.forum_permission_handler = PermissionHandler()
     # Run
     feed.get_object(request, forum_pk=self.forum_2.pk, descendants=False)
     topics = feed.items()
     # Check
     assert list(topics) == [self.topic_2, ]
Esempio n. 6
0
 def test_can_return_all_the_topics_that_can_be_read_by_the_current_user(self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     request.forum_permission_handler = PermissionHandler()
     # Run
     feed.get_object(request)
     topics = feed.items()
     # Check
     assert list(topics) == [self.topic_3, self.topic_2, self.topic_1, ]
Esempio n. 7
0
 def test_can_return_all_the_topics_that_can_be_read_by_the_current_user_in_a_forum_including_its_descendants(self):  # noqa
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     request.forum_permission_handler = PermissionHandler()
     # Run
     feed.get_object(request, forum_pk=self.forum_2.pk, descendants=True)
     topics = feed.items()
     # Check
     assert list(topics) == [self.topic_3, self.topic_2, ]
Esempio n. 8
0
 def test_can_return_the_proper_item_link(self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     request.forum_permission_handler = PermissionHandler()
     # Run & check
     assert feed.item_link(self.topic_2) == reverse(
         'forum_conversation:topic', kwargs={
             'forum_slug': self.topic_2.forum.slug, 'forum_pk': self.topic_2.forum.pk,
             'slug': self.topic_2.slug, 'pk': self.topic_2.id,
         })
Esempio n. 9
0
 def test_can_return_all_the_topics_that_can_be_read_by_the_current_user_in_a_forum_including_its_descendants(
         self):
     # Setup
     feed = LastTopicsFeed()
     request = self.factory.get('/')
     request.user = self.user
     # Run
     feed.get_object(request, forum_pk=self.forum_2.pk, descendants=True)
     topics = feed.items()
     # Check
     assert list(topics) == [
         self.topic_3,
         self.topic_2,
     ]