def test_import_filter_by_date_all(self): # First get the date of the last item results, latest_date = SyndicationModularInput.get_feed("http://feeds.feedburner.com/456bereastreet", return_latest_date=True) # Try it and see if we get zero results results = SyndicationModularInput.get_feed("http://feeds.feedburner.com/456bereastreet", include_later_than=latest_date) self.assertGreaterEqual(len(results), 0)
def test_import_filter_by_date(self): # First get the date of the last item results, latest_date = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml", return_latest_date=True) # Back off the date by a second latest_datetime = datetime.fromtimestamp(time.mktime(latest_date)) latest_date_minus_second = latest_datetime - timedelta(seconds=1) latest_date_minus_second_struct = latest_date_minus_second.timetuple() # Try it and see if we get one result results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml", include_later_than=latest_date_minus_second_struct) self.assertGreaterEqual(len(results), 1)
def test_basic_auth_rss(self): username = '******' password = '******' results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/auth/rss_example.xml", username="******", password="******") self.assertEqual(len(results), 2)
def test_import_return_latest_date(self): results, latest_date = SyndicationModularInput.get_feed( "http://feeds.feedburner.com/456bereastreet", return_latest_date=True) self.assertGreaterEqual(len(results), 10) self.assertIsNotNone(latest_date)
def handle_results(self, results, session_key, in_preview): results = SyndicationModularInput.get_feed(self.url, self.username, self.password, clean_html=self.clean_html, logger=self.logger) self.output_results(results)
def test_import_return_latest_date(self): results, latest_date = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml", return_latest_date=True) self.assertGreaterEqual(len(results), 0) self.assertIsNotNone(latest_date)
def test_import_atom(self): results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml") self.assertGreaterEqual(len(results), 1)
def test_import_atom_public(self): results = SyndicationModularInput.get_feed("http://currentworldnews.blogspot.com/atom.xml") self.assertGreaterEqual(len(results), 10)
def test_import_rss_public(self): results = SyndicationModularInput.get_feed("http://answers.splunk.com/feed/questions.rss") self.assertGreaterEqual(len(results), 10)
def test_cleanup_html_rss(self): # https://lukemurphey.net/issues/2038 results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/rss_with_html.xml", clean_html=True) self.assertEqual(len(results), 3) self.assertEqual(results[2]['content.0.value'][:120], " 1. **Introduction**\n\nIt seems that Google Chrome extensions have become quite the tool for banking\nmalware fraudsters.")