Exemplo n.º 1
0
 def setUp(self):
     self.gs = GoogleSearch('query text')
     fixture_path = normpath(
         join(dirname(__file__), ('../../../../tests/'
                                  'fixtures/search/googleSearch.html')))
     self.fixture = open(fixture_path)
     self.page = BeautifulSoup(self.fixture.read())
Exemplo n.º 2
0
class TestGoogleSearch(unittest.TestCase):
    def setUp(self):
        self.gs = GoogleSearch('query text')
        fixture_path = normpath(join(dirname(__file__), ('../../../../tests/'
                                     'fixtures/search/googleSearch.html')))
        self.fixture = open(fixture_path)
        self.page = BeautifulSoup(self.fixture.read())

    def tearDown(self):
        self.fixture.close()

    def test_extract_info(self):
        search_info = self.gs._extract_info(self.page)
        self.failUnless(search_info['to'] == 30, 'Wrong "to" field')
        self.failUnless(search_info['from'] == 21, 'Wrong "from" field')
        self.failUnless(search_info['total'] == 136000, 'Wrong "total" field')
Exemplo n.º 3
0
class TestGoogleSearch(unittest.TestCase):
    def setUp(self):
        self.gs = GoogleSearch('query text')
        fixture_path = normpath(
            join(dirname(__file__), ('../../../../tests/'
                                     'fixtures/search/googleSearch.html')))
        self.fixture = open(fixture_path)
        self.page = BeautifulSoup(self.fixture.read())

    def tearDown(self):
        self.fixture.close()

    def test_extract_info(self):
        search_info = self.gs._extract_info(self.page)
        self.failUnless(search_info['to'] == 30, 'Wrong "to" field')
        self.failUnless(search_info['from'] == 21, 'Wrong "from" field')
        self.failUnless(search_info['total'] == 136000, 'Wrong "total" field')
Exemplo n.º 4
0
 def setUp(self):
     self.gs = GoogleSearch('query text')
     fixture_path = normpath(join(dirname(__file__), ('../../../../tests/'
                                  'fixtures/search/googleSearch.html')))
     self.fixture = open(fixture_path)
     self.page = BeautifulSoup(self.fixture.read())