Пример #1
0
 def test_entry_list_type(self):
     "Entry list will always return a django QuerySet list"
     entry_list = logic.user_entry_list(self.get_user())
     self.assertTrue(isinstance(entry_list,
                                django.db.models.query.QuerySet))
     entry_list = logic.user_entry_list(self.get_user(), unread=False)
     self.assertTrue(isinstance(entry_list,
                                django.db.models.query.QuerySet))
Пример #2
0
 def setUp(self):
     logic.pull_feed("http://localhost:8000/endtimes/test/slashdot.xml",
                     user=self.get_user(),
                     create_entries=True)
     self.c = Client()
     self.assertTrue(self.c.login(username='******', password='******'))
     self.entryobj = logic.user_entry_list(self.get_user())[0]
Пример #3
0
 def test_unread_entry_list_ordering(self):
     """Test user_entry_list will return all unread entries available to
     user, sorted chronologically, oldest to newest."""
     # read a few of the entries so we can exclude them
     for entry in self.feedobj.entry_set.all()[:5]:
         logic.mark_entry_read(self.get_user(), entry)
     self._test_order(logic.user_entry_list(self.get_user(), unread=True))
Пример #4
0
 def test_group_datetime(self):
     "A list of entry objects can be grouped by their last_published attribute"
     entry_list = logic.user_entry_list(self.get_user())
     grouped_entry_list = logic.group_entry_list(entry_list,
                                                 logic.datetime_grouper)
     self.assertTrue(isinstance(grouped_entry_list, dict))
     keys = grouped_entry_list.keys()
     self.assertTrue(callable(keys[0]))
     self.assertTrue(isinstance(grouped_entry_list[keys[0]], list))
     for key, sublist in grouped_entry_list.iteritems():
         self.assertTrue(len(sublist) > 0)
Пример #5
0
 def test_client_republish_feed(self):
     "Any user can access a feed of their generated entries"
     userobj = self.get_user()
     entryobj = logic.user_entry_list(self.get_user())[0]
     repubobj = logic.republish_entry(userobj, entryobj)
     c = Client()
     resp = c.get(
         reverse('republished-atom-feed',
                 kwargs={
                     'uid': userobj.id,
                     'username': userobj.username
                 }))
     self.assertTrue(resp.status_code, 200)
     self.assertEqual(len(feedparser.parse(resp.content).entries), 1)
Пример #6
0
 def test_entry_list(self):
     "Entry list will return all entries belonging to given user"
     entry_list = logic.user_entry_list(self.get_user())
     self.assertEqual(len(entry_list), 15)
     entry_list2 = logic.user_entry_list(self.get_staff())
     self.assertEqual(len(entry_list2), 0)
Пример #7
0
 def test_entry_list_ordering(self):
     """Test user_entry_list will return all entries available to
     user, sorted chronologically, oldest to newest."""
     self._test_order(logic.user_entry_list(self.get_user(), unread=False))
Пример #8
0
 def setUp(self):
     # add feed and subscribe user
     logic.pull_feed("http://localhost:8000/endtimes/test/slashdot.xml",
                     user=self.get_user())
     self.entryobj = logic.user_entry_list(self.get_user())[0]