def test_read_functions(self): """ check read functions for an entry """ httpd = FeedParserTestServer(1) httpd.start() rssUrl = 'http://localhost:8097/src/reader/test_rss/test_2.rss' tempRss = Feed(name="Temp", url=rssUrl) tempRss.fetch() self.assertEqual(tempRss.unread(), 1) entry = FeedEntry.objects.all()[0] entry.markRead() self.assertEqual(tempRss.unread(), 0)
def test_view_ajax_mark_read(self): """ Test view for mark server """ httpd = FeedParserTestServer(1) httpd.start() rssUrl = 'http://localhost:8097/src/reader/test_rss/test_2.rss' tempRss = Feed(name="Temp", url=rssUrl) tempRss.fetch() response = self.client.get('/markRead/1/', HTTP_X_REQUESTED_WITH='XMLHttpRequest') self.assertEqual(response.status_code, 200) self.assertEqual(tempRss.unread(), 0) # bad request response = self.client.get('/markRead/10/', HTTP_X_REQUESTED_WITH='XMLHttpRequest') self.assertEqual(response.status_code, 500)