def test_GamesListNoResults(self):
     f = os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'tests', 'testdata', 'scraper_web_responses', 'thegamesdb_getgameslist_noresults.xml')
     scraper = TheGamesDB_Scraper()
     with open(f) as xmlfile:
         data = xmlfile.read()
     results = scraper._parseSearchResults(data)
     self.assertIsInstance(results, list, "Expected search results to return list even if no results found")
     self.assertEqual(len(results), 0, "Empty search results should return empty list")
    def test_GamesListResults(self):
        f = os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'tests', 'testdata', 'scraper_web_responses', 'thegamesdb_getgameslist.xml')
        scraper = TheGamesDB_Scraper()

        with open(f) as xmlfile:
            data = xmlfile.read()
        results = scraper._parseSearchResults(data)

        # Expect 3 results
        self.assertEqual(len(results), 3, "Number of search results for multiple search match did not match expected number")
Ejemplo n.º 3
0
 def test_GamesListNoResults(self):
     f = os.path.join(os.path.dirname(__file__), '..', '..', 'resources',
                      'tests', 'testdata', 'scraper_web_responses',
                      'thegamesdb_getgameslist_noresults.xml')
     scraper = TheGamesDB_Scraper()
     with open(f) as xmlfile:
         data = xmlfile.read()
     results = scraper._parseSearchResults(data)
     self.assertIsInstance(
         results, list,
         "Expected search results to return list even if no results found")
     self.assertEqual(len(results), 0,
                      "Empty search results should return empty list")
Ejemplo n.º 4
0
    def test_GamesListResultsNonAscii(self):
        f = os.path.join(os.path.dirname(__file__), '..', '..', 'resources',
                         'tests', 'testdata', 'scraper_web_responses',
                         'thegamesdb_getgameslist_nonascii.xml')
        scraper = TheGamesDB_Scraper()

        with open(f) as xmlfile:
            data = xmlfile.read()
        results = scraper._parseSearchResults(data)

        # Expect 289 valid results out of 303 entries
        self.assertEqual(
            len(results), 289,
            "Number of search results for multiple search match did not match expected number"
        )