aboutsummaryrefslogtreecommitdiffstats
path: root/test_gg_scrapper.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2013-12-27 03:42:30 +0100
committerMatěj Cepl <mcepl@redhat.com>2013-12-28 00:04:17 +0100
commit9dcfa6e10d512cb767dac9c410c96072f7cbd166 (patch)
tree38b59a4d256a23f7aef31122b45283b420cb21cd /test_gg_scrapper.py
parentb33d37e962697141043e3c6d71417a525808d405 (diff)
downloadgg_scraper-9dcfa6e10d512cb767dac9c410c96072f7cbd166.tar.gz
Collecting topics.
Added also some testing pages.
Diffstat (limited to 'test_gg_scrapper.py')
-rw-r--r--test_gg_scrapper.py13
1 files changed, 11 insertions, 2 deletions
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()