def test_load_opml_no_duplicates(self): """ Assert multiple calls to the load_opml creates no duplicates """ self.assertEqual(Feed.objects.count(), 0) self.assertEqual(load_opml(FEEDLY), 36) self.assertEqual(Feed.objects.count(), 36) for _ in range(10): self.assertEqual(load_opml(FEEDLY), 0) self.assertEqual(Feed.objects.count(), 36)
def test_load_opml_no_duplicates(self): """ Assert multiple calls to the load_opml creates no duplicates """ self.assertEqual(Feed.objects.count(), 0) self.assertEqual(load_opml(FEEDLY), 36) self.assertEqual(Feed.objects.count(), 36) for _ in xrange(10): self.assertEqual(load_opml(FEEDLY), 0) self.assertEqual(Feed.objects.count(), 36)
def handle(self, args): # Connect to the database db.connect() # Load the OPML files into the database count = sum(load_opml(path) for path in args.opml) return "Ingested {} feeds from {} OPML files".format(count, len(args.opml))
def test_load_opml_integrated(self): """ Test the integration of the ingest helper function """ self.assertEqual(Feed.objects.count(), 0) self.assertEqual(load_opml(FEEDLY), 36) self.assertEqual(Feed.objects.count(), 36) for feed in Feed.objects(): self.assertIn('xmlUrl', feed.urls) self.assertIn('htmlUrl', feed.urls)