From 9dcfa6e10d512cb767dac9c410c96072f7cbd166 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 27 Dec 2013 03:42:30 +0100 Subject: Collecting topics. Added also some testing pages. --- test_gg_scrapper.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'test_gg_scrapper.py') diff --git a/test_gg_scrapper.py b/test_gg_scrapper.py index 079c3c1..1a75aab 100644 --- a/test_gg_scrapper.py +++ b/test_gg_scrapper.py @@ -1,6 +1,10 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals, print_function, absolute_import +import logging import unittest import gg_scrapper +IN_URL = 'https://groups.google.com/forum/#!forum/jbrout' ORIG_URL = 'http://groups.google.com/d/forum/jbrout' EXP_URL = 'https://groups.google.com/forum/' + \ '?_escaped_fragment_=forum/jbrout' @@ -8,13 +12,18 @@ EXP_URL = 'https://groups.google.com/forum/' + \ class TestGGScrapper(unittest.TestCase): def test_URL_conversion(self): - in_URL = 'https://groups.google.com/forum/#!forum/jbrout' - obs_URL = gg_scrapper.GooglePage.unenscape_Google_bang_URL(in_URL) + obs_URL = gg_scrapper.GooglePage.unenscape_Google_bang_URL(IN_URL) self.assertEqual(obs_URL, EXP_URL) def test_do_redirect(self): obs_URL = gg_scrapper.GooglePage.do_redirect(ORIG_URL) self.assertEqual(obs_URL, EXP_URL) + def test_collecting_topics(self): + page = gg_scrapper.GooglePage(IN_URL) + topics = page.get_topics(page.bs_page) + logging.debug("number of topics = %d", len(topics)) + self.assertGreater(len(topics), 0) + if __name__ == '__main__': unittest.main() -- cgit