def test_import_initial_offline_gdbi(self): config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[2] = conf.romCollections['2'] #adjust settings xbmcaddon._settings['rcb_nfoFolder'] = '' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(2, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 4) adventure = games[0] self.assertEquals(adventure[GameView.COL_NAME], 'Adventure') self.assertEquals(adventure[GameView.COL_year], '1980') self.assertEquals(adventure[GameView.COL_publisher], 'Atari, Inc.') self.assertEquals(adventure[GameView.COL_developer], 'Atari, Inc.') self.assertEquals(adventure[GameView.COL_genre], 'Adventure') self.assertEquals(adventure[GameView.COL_rating], '3.8') self.assertEquals(adventure[GameView.COL_maxPlayers], '1 Player') self.assertTrue(adventure[GameView.COL_description].startswith( 'A graphic dungeon quest inspired by the old mainframe game of the same name' )) airSeaBattle = games[1] self.assertEquals(airSeaBattle[GameView.COL_NAME], 'Air-Sea Battle') self.assertEquals(airSeaBattle[GameView.COL_year], '1977') self.assertEquals(airSeaBattle[GameView.COL_publisher], 'Sears, Roebuck and Co.') self.assertEquals(airSeaBattle[GameView.COL_developer], 'Atari, Inc.') self.assertEquals(airSeaBattle[GameView.COL_genre], 'Shooter') self.assertEquals(airSeaBattle[GameView.COL_rating], '2.4') self.assertEquals(airSeaBattle[GameView.COL_maxPlayers], '1-2 Players') self.assertTrue(airSeaBattle[GameView.COL_description].startswith( 'Air-Sea Battle is basically a target shooting game.')) asteroids = games[2] self.assertEquals(asteroids[GameView.COL_NAME], 'Asteroids') self.assertEquals(asteroids[GameView.COL_year], '1981') self.assertEquals(asteroids[GameView.COL_publisher], 'Atari, Inc.') self.assertEquals(asteroids[GameView.COL_developer], 'Atari, Inc.') self.assertEquals(asteroids[GameView.COL_genre], 'Shooter') self.assertEquals(asteroids[GameView.COL_rating], '3.5') self.assertEquals(asteroids[GameView.COL_maxPlayers], '1-2 Players') self.assertTrue(asteroids[GameView.COL_description].startswith( 'Asteroids is a conversion of the arcade game of the same name.'))
def test_getFilesByWildcard(self): dbu = DBUpdate() # FIXME TODO Not sure what this function is meant to do fname = dbu.getFilesByWildcard( "/Users/andrew/Games/Emulation/SNES/Chrono Trigger (USA).zip") print("fname is {0}".format(fname)) a = FileType() a.id, a.name, a.parent = 0, "rcb_rom", "game" print(a)
def test_import_multirompath_multidisc(self): config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[4] = conf.romCollections['4'] self.register_responses_PSX() # adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'true' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(4, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 2) bushido = games[0] self.assertEquals(bushido[GameView.COL_NAME], 'Bushido Blade') self.assertEquals(bushido[GameView.COL_year], '1997') self.assertTrue(bushido[GameView.COL_description].startswith( '"Bushido" is the soul of Japan - an ancient honor code deeply followed by samurai warriors for centuries' )) self.assertEquals(bushido[GameView.COL_genre], 'Fighting') self.assertEquals(bushido[GameView.COL_maxPlayers], '2') self.assertEquals(bushido[GameView.COL_publisher], 'Square, SCEA') self.assertEquals(bushido[GameView.COL_developer], 'Light Weight') roms = File(self.gdb).getRomsByGameId(bushido[GameView.COL_ID]) self.assertEquals(len(roms), 1) silenthill = games[1] self.assertEquals(silenthill[GameView.COL_NAME], 'Silent Hill') self.assertEquals(silenthill[GameView.COL_year], '1999') self.assertTrue(silenthill[GameView.COL_description].startswith( 'Silent Hill is a 1999 survival horror video game for the PlayStation.' )) self.assertEquals(silenthill[GameView.COL_genre], 'Action, Horror') self.assertEquals(silenthill[GameView.COL_maxPlayers], '1') self.assertEquals(silenthill[GameView.COL_publisher], 'Konami Digital Entertainment') self.assertEquals(silenthill[GameView.COL_developer], 'Team Silent, Konami') roms = File(self.gdb).getRomsByGameId(silenthill[GameView.COL_ID]) self.assertEquals(len(roms), 2)
def test_import_gameasfolder(self): config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[5] = conf.romCollections['5'] self.register_responses() self.register_responses_SNES() # adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'true' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(5, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 2) chronoTrigger = games[0] self.assertEquals(chronoTrigger[GameView.COL_NAME], 'Chrono Trigger') self.assertEquals(chronoTrigger[GameView.COL_year], '1995') self.assertTrue(chronoTrigger[GameView.COL_description].startswith( 'The 32-Meg quest begins.')) self.assertEquals(chronoTrigger[GameView.COL_genre], 'Role-Playing') self.assertEquals(chronoTrigger[GameView.COL_maxPlayers], '1') self.assertEquals(chronoTrigger[GameView.COL_publisher], 'Squaresoft') self.assertEquals(chronoTrigger[GameView.COL_developer], 'Squaresoft') roms = File(self.gdb).getRomsByGameId(chronoTrigger[GameView.COL_ID]) self.assertEquals(len(roms), 1) maddennfl = games[1] self.assertEquals(maddennfl[GameView.COL_NAME], 'Madden NFL 97') self.assertEquals(maddennfl[GameView.COL_year], '1996') self.assertTrue(maddennfl[GameView.COL_description].startswith( 'Welcome to Madden NFL 97, the game that captures the excitement of a 30 yard touchdown pass' )) self.assertEquals(maddennfl[GameView.COL_genre], 'Sports') self.assertEquals(maddennfl[GameView.COL_maxPlayers], '2') self.assertEquals(maddennfl[GameView.COL_publisher], 'Electronic Arts') self.assertEquals(maddennfl[GameView.COL_developer], 'Electronic Arts') roms = File(self.gdb).getRomsByGameId(maddennfl[GameView.COL_ID]) self.assertEquals(len(roms), 1)
def test_getFoldernameFromRomFilename(self): dbu = DBUpdate() # POSIX fname = dbu.getFoldernameFromRomFilename( "/Users/User/Games/Emulation/SNES/Chrono Trigger (USA).zip") self.assertEqual(fname, "SNES") # Windows #fname = dbu.getFoldernameFromRomFilename("c:\\Users\\user.name\\Games\\Emulation\\SNES\\Chrono Trigger (USA).zip") #self.assertEqual(fname, "SNES") fname = dbu.getFoldernameFromRomFilename("Chrono Trigger (USA).zip") self.assertEqual(fname, "")
def test_getFilesByGameNameIgnoreCase(self): """ /Users/andrew/Games/Emulation/SNES/Artwork/fanart/Madden NFL 97.* /Users/andrew/Games/Emulation/SNES/Artwork/fanart/SNES.* /Users/andrew/Games/Emulation/SNES/Artwork/fanart/Madden NFL '97 (USA).* Returns: """ dbu = DBUpdate() fname = dbu.getFilesByWildcard( "/Users/user/Games/Emulation/SNES/Chrono Trigger (USA).*") print "test_getFilesByGameNameIgnoreCase" print fname
def test_AddNewElementsUnicode(self): ps = DBUpdate() existingResults = {"SearchKey": ["Random Game"]} newResults = { "Description": [ u"'Super Keirin (スーパー競輪, Super Keirin) is a Japan-exclusive video game" ] } existingResults = ps.addNewElements(existingResults, newResults) self.assertEqual( existingResults.get("Description")[0], u"'Super Keirin (スーパー競輪, Super Keirin) is a Japan-exclusive video game", "Expected Unicode string to be handled when adding new search result element" )
def test_update_rescrape(self): """test if update a rom collection works at all: all properties should have been updated""" config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[1] = conf.romCollections['1'] self.register_responses() self.register_responses_Amiga() # adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' xbmcaddon._settings['rcb_enableFullReimport'] = 'true' xbmcaddon._settings['rcb_overwriteWithNullvalues'] = 'false' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(1, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 4) airborneRanger = games[0] self.assertEquals(airborneRanger[GameView.COL_NAME], 'Airborne Ranger') self.assertEquals(airborneRanger[GameView.COL_year], '1990') self.assertTrue(airborneRanger[GameView.COL_description].startswith( 'Update: In this action/simulation game by Microprose the player takes the role of an U.S. Army airborne ranger.' )) self.assertEquals(airborneRanger[GameView.COL_genre], 'Action, Adventure') self.assertEquals(airborneRanger[GameView.COL_publisher], 'MicroProse Software, Inc.') self.assertEquals(airborneRanger[GameView.COL_developer], 'Imagitec Design Inc.') self.assertEquals(airborneRanger[GameView.COL_maxPlayers], '1') roms = File(self.gdb).getRomsByGameId(airborneRanger[GameView.COL_ID]) self.assertEquals(len(roms), 1)
def test_update_rescrape_nullvalues(self): """test if update works when rcb_overwriteWithNullvalues is set to true""" config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[1] = conf.romCollections['1'] self.register_responses() self.register_responses_Amiga_nullvalues() # adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' xbmcaddon._settings['rcb_enableFullReimport'] = 'true' xbmcaddon._settings['rcb_overwriteWithNullvalues'] = 'true' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(1, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 4) airborneRanger = games[0] self.assertEquals(airborneRanger[GameView.COL_NAME], 'Airborne Ranger') self.assertEquals(airborneRanger[GameView.COL_year], None) self.assertEquals(airborneRanger[GameView.COL_description], '') # HACK: genres are stored in genregame link table and are not overwritten with null values self.assertEquals(airborneRanger[GameView.COL_genre], 'Action, Adventure') self.assertEquals(airborneRanger[GameView.COL_publisher], None) self.assertEquals(airborneRanger[GameView.COL_developer], None) self.assertEquals(airborneRanger[GameView.COL_maxPlayers], None) roms = File(self.gdb).getRomsByGameId(airborneRanger[GameView.COL_ID]) self.assertEquals(len(roms), 1)
def test_update_norescrape_config_allowupdate(self): """test if update is skipped when allowupdate is set to false in config.xml""" config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_allowupdate.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[1] = conf.romCollections['1'] self.register_responses_Amiga_nullvalues() # adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' xbmcaddon._settings['rcb_enableFullReimport'] = 'true' xbmcaddon._settings['rcb_overwriteWithNullvalues'] = 'true' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = Game(self.gdb).getGamesByFilter(1, 0, 0, 0, 0, likeStmnt) self.assertEquals(len(games), 4) airborneRanger = games[0] self.assertEquals(airborneRanger.name, 'Airborne Ranger') self.assertEquals(airborneRanger.year, '1989') self.assertTrue( airborneRanger.plot.startswith( 'In this action/simulation game by Microprose the player takes the role of an U.S. Army airborne ranger.' )) self.assertEquals(airborneRanger.genre, 'Action, Adventure') self.assertEquals(airborneRanger.publisher, 'MicroProse') self.assertEquals(airborneRanger.developer, 'Imagitec') self.assertEquals(airborneRanger.maxPlayers, '1') roms = File(self.gdb).getRomsByGameId(airborneRanger.id) self.assertEquals(len(roms), 1)
def test_AddNewElements(self): ps = DBUpdate() existingResults = {"SearchKey": ["Tekken 2"], "Publisher": []} newResults = { "SearchKey": ["Tekken 3"], "Description": ["Tekken 2 description & history"], "Publisher": ["Namco"] } existingResults = ps.addNewElements(existingResults, newResults) self.assertIn("Description", existingResults, "Expected to add Description") self.assertEqual( existingResults.get("SearchKey")[0], "Tekken 2", "Expected existing field SearchKey to not be overwritten (now {0})" .format(existingResults.get("SearchKey")[0])) self.assertEqual( existingResults.get("Publisher")[0], "Namco", "Expected existing but empty field Publisher to be overwritten")
def test_import_initial_special_characters(self): config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[3] = conf.romCollections['3'] self.register_responses() self.register_responses_N64() # adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'true' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(3, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 1) snowboarding = games[0] self.assertEquals(snowboarding[GameView.COL_NAME], u'1080\xb0 Snowboarding') # TODO check for description with special characters # self.assertTrue(snowboarding[GameView.COL_description].startswith(u"You’re taking a Tahoe 155 snowboard down a steep, bumpy incline at night and you’re about to top off an Indy Nosebone with a 360° Air")) self.assertEquals(snowboarding[GameView.COL_year], '1998') self.assertEquals(snowboarding[GameView.COL_genre], 'Sports') self.assertEquals(snowboarding[GameView.COL_publisher], 'Nintendo') self.assertEquals(snowboarding[GameView.COL_developer], 'Nintendo EAD') roms = File(self.gdb).getRomsByGameId(snowboarding[GameView.COL_ID]) self.assertEquals(len(roms), 1)
def test_update_norescrape_config_allowupdate(self): """test if update is skipped when allowupdate is set to false in config.xml""" config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_allowupdate.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[1] = conf.romCollections['1'] self.register_responses_Amiga_nullvalues() # adjust settings xbmcaddon._settings['rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' xbmcaddon._settings['rcb_enableFullReimport'] = 'true' xbmcaddon._settings['rcb_overwriteWithNullvalues'] = 'true' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = Game(self.gdb).getGamesByFilter(1, 0, 0, 0, 0, likeStmnt) self.assertEquals(len(games), 4) airborneRanger = games[0] self.assertEquals(airborneRanger.name, 'Airborne Ranger') self.assertEquals(airborneRanger.year, '1989') self.assertTrue(airborneRanger.plot.startswith( 'In this action/simulation game by Microprose the player takes the role of an U.S. Army airborne ranger.')) self.assertEquals(airborneRanger.genre, 'Action, Adventure') self.assertEquals(airborneRanger.publisher, 'MicroProse') self.assertEquals(airborneRanger.developer, 'Imagitec') self.assertEquals(airborneRanger.maxPlayers, '1') roms = File(self.gdb).getRomsByGameId(airborneRanger.id) self.assertEquals(len(roms), 1)
def test_update_rescrape_nullvalues(self): """test if update works when rcb_overwriteWithNullvalues is set to true""" config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[1] = conf.romCollections['1'] self.register_responses_Amiga_nullvalues() # adjust settings xbmcaddon._settings['rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' xbmcaddon._settings['rcb_enableFullReimport'] = 'true' xbmcaddon._settings['rcb_overwriteWithNullvalues'] = 'true' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = Game(self.gdb).getGamesByFilter(1, 0, 0, 0, 0, likeStmnt) self.assertEquals(len(games), 4) airborneRanger = games[0] self.assertEquals(airborneRanger.name, 'Airborne Ranger Update') self.assertEquals(airborneRanger.year, None) self.assertEquals(airborneRanger.plot, '') #HACK: genres are stored in genregame link table and are not overwritten with null values self.assertEquals(airborneRanger.genre, 'Action, Adventure') self.assertEquals(airborneRanger.publisher, None) self.assertEquals(airborneRanger.developer, None) self.assertEquals(airborneRanger.maxPlayers, '') roms = File(self.gdb).getRomsByGameId(airborneRanger.id) self.assertEquals(len(roms), 1)
def test_import_initial_accurate_gameswithoutdesc(self): config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_importtests.xml') conf = Config(config_xml_file) conf.readXml() rcs = {} rcs[1] = conf.romCollections['1'] self.register_responses_Amiga() #adjust settings xbmcaddon._settings[ 'rcb_nfoFolder'] = './script.games.rom.collection.browser/nfo/' xbmcaddon._settings['rcb_PreferNfoFileIfAvailable'] = 'false' xbmcaddon._settings['rcb_ignoreGamesWithoutDesc'] = 'false' xbmcaddon._settings['rcb_scrapingMode'] = 'Automatic: Accurate' dbu = DBUpdate() dbu.updateDB(self.gdb, RCBMockGui(), rcs, False) likeStmnt = '0 = 0' games = GameView(self.gdb).getFilteredGames(1, 0, 0, 0, 0, 0, 0, 0, 0, likeStmnt, '', 0) self.assertEquals(len(games), 4) airborneRanger = games[0] self.assertEquals(airborneRanger[GameView.COL_NAME], 'Airborne Ranger') self.assertEquals(airborneRanger[GameView.COL_year], '1989') self.assertTrue(airborneRanger[GameView.COL_description].startswith( 'In this action/simulation game by Microprose the player takes the role of an U.S. Army airborne ranger.' )) self.assertEquals(airborneRanger[GameView.COL_genre], 'Action, Adventure') self.assertEquals(airborneRanger[GameView.COL_publisher], 'MicroProse') self.assertEquals(airborneRanger[GameView.COL_developer], 'Imagitec') self.assertEquals(airborneRanger[GameView.COL_maxPlayers], '1') roms = File(self.gdb).getRomsByGameId(airborneRanger[GameView.COL_ID]) self.assertEquals(len(roms), 1) chuckRock = games[1] self.assertEquals(chuckRock[GameView.COL_NAME], 'Chuck Rock') self.assertEquals(chuckRock[GameView.COL_year], '1991') self.assertTrue(chuckRock[GameView.COL_description].startswith( "Chuck Rock hasn't been the same since his long-time rival in love, the evil Gary Gritter, kidnapped his wife, the beautiful Ophelia." )) self.assertEquals(chuckRock[GameView.COL_genre], 'Platform') self.assertEquals(chuckRock[GameView.COL_publisher], 'Core Design') self.assertEquals(chuckRock[GameView.COL_developer], 'Core Design') self.assertEquals(chuckRock[GameView.COL_maxPlayers], '1') self.assertEquals(chuckRock[GameView.COL_rating], '8') roms = File(self.gdb).getRomsByGameId(chuckRock[GameView.COL_ID]) self.assertEquals(len(roms), 1) eliminator = games[2] self.assertEquals(eliminator[GameView.COL_NAME], 'Eliminator') self.assertEquals(eliminator[GameView.COL_year], None) roms = File(self.gdb).getRomsByGameId(eliminator[GameView.COL_ID]) self.assertEquals(len(roms), 1) formulaOne = games[3] self.assertEquals(formulaOne[GameView.COL_NAME], 'MicroProse Formula One Grand Prix') self.assertEquals(formulaOne[GameView.COL_year], '1991') self.assertTrue(formulaOne[GameView.COL_description].startswith( "MicroProse Formula One Grand Prix is a racing simulator released in 1991 by MicroProse and created by game designer Geoff Crammond." )) #HACK: Order of genres depends on id in database. If we run the full set of tests Genre Sports might already be #in database and has a lower id than Racing self.assertTrue(formulaOne[GameView.COL_genre] == 'Racing, Sports' or formulaOne[GameView.COL_genre] == 'Sports, Racing') self.assertEquals(formulaOne[GameView.COL_publisher], 'MicroProse') self.assertEquals(formulaOne[GameView.COL_developer], None) self.assertEquals(formulaOne[GameView.COL_maxPlayers], '1') roms = File(self.gdb).getRomsByGameId(formulaOne[GameView.COL_ID]) self.assertEquals(len(roms), 4)