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())
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')
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')
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())