def test_when_using_urls_the_correct_web_executor_loads(self): # arrange launcherPath = FakeFile('durp\\apple\\durp') settings = {} # act factory = ExecutorFactory(AEL_Paths(), settings) executor = factory.create(FakeFile('steam://rungameid/')) # assert actual = executor.__class__.__name__ expected = 'WebBrowserExecutor' self.assertEqual(actual, expected)
def test_if_xbmc_apppath_factory_loads_with_correct_executor(self): # arrange set_log_level(LOG_VERB) launcherPath = FakeFile('c:\\boop\\xbmc.exe') settings = {} # act factory = ExecutorFactory(AEL_Paths(), settings) executor = factory.create(launcherPath) # assert actual = executor.__class__.__name__ expected = 'XbmcExecutor' self.assertEqual(actual, expected)
def test_if_on_linux_factory_loads_with_correct_executor( self, is_linux_mock, is_windows_mock): # arrange is_linux_mock.return_value = True is_windows_mock.return_value = False launcherPath = FakeFile('path') settings = {} settings['lirc_state'] = True # act factory = ExecutorFactory(AEL_Paths(), settings) executor = factory.create(launcherPath) # assert actual = executor.__class__.__name__ expected = 'LinuxExecutor' self.assertEqual(actual, expected)
def test_if_on_osx_factory_loads_with_correct_executor( self, is_linux_mock, is_osx_mock, is_windows_mock): # arrange is_linux_mock.return_value = False is_windows_mock.return_value = False is_osx_mock.return_value = True launcherPath = FakeFile('durp\\apple\\durp') settings = {} # act factory = ExecutorFactory(AEL_Paths(), settings) executor = factory.create(launcherPath) # assert actual = executor.__class__.__name__ expected = 'OSXExecutor' self.assertEqual(actual, expected)
def test_if_on_windows_with_lnk_files_factory_loads_with_correct_executor( self, is_linux_mock, is_osx_mock, is_windows_mock): # arrange is_linux_mock.return_value = False is_windows_mock.return_value = True is_osx_mock.return_value = False launcherPath = FakeFile('c:\\app\\testcase.lnk') settings = {} # act factory = ExecutorFactory(settings, AEL_Paths()) executor = factory.create(launcherPath) # assert actual = executor.__class__.__name__ expected = 'WindowsLnkFileExecutor' self.assertEqual(actual, expected)
def test_scraping_metadata_for_game(self): # arrange settings = self.get_test_settings() launcher = StandardRomLauncher(None, settings, None, None, None, None, None) launcher.set_platform('Nintendo NES') rom = ROM({'id': 1234}) fakeRomPath = FakeFile('/my/nice/roms/castlevania [ROM] (test) v2.zip') target = CleanTitleScraper(settings, launcher) # act actual = target.scrape_metadata('castlevania x', fakeRomPath, rom) # assert self.assertTrue(actual) self.assertEqual(u'castlevania v2', rom.get_name()) print(rom)
def test_scraping_assets_for_game(self): # arrange settings = self.get_test_settings() assets_to_scrape = [ g_assetFactory.get_asset_info(ASSET_BOXFRONT_ID), g_assetFactory.get_asset_info(ASSET_BOXBACK_ID), g_assetFactory.get_asset_info(ASSET_SNAP_ID) ] launcher = StandardRomLauncher(None, settings, None, None, None, None, None) launcher.set_platform('Nintendo NES') launcher.set_asset_path( g_assetFactory.get_asset_info(ASSET_BOXFRONT_ID), '/my/nice/assets/front/') launcher.set_asset_path( g_assetFactory.get_asset_info(ASSET_BOXBACK_ID), '/my/nice/assets/back/') launcher.set_asset_path(g_assetFactory.get_asset_info(ASSET_SNAP_ID), '/my/nice/assets/snaps/') rom = ROM({'id': 1234}) fakeRomPath = FakeFile('/my/nice/roms/castlevania.zip') target = CleanTitleScraper(settings, launcher) # act actuals = [] for asset_to_scrape in assets_to_scrape: an_actual = target.scrape_asset('castlevania', asset_to_scrape, fakeRomPath, rom) actuals.append(an_actual) # assert for actual in actuals: self.assertFalse(actual) print(rom)
def test_if_on_windows_factory_loads_with_correct_executor( self, is_linux_mock, is_osx_mock, is_windows_mock): # arrange is_linux_mock.return_value = False is_windows_mock.return_value = True is_osx_mock.return_value = False launcherPath = FakeFile('path') settings = {} settings['windows_cd_apppath'] = '' settings['windows_close_fds'] = '' # act factory = ExecutorFactory(settings, AEL_Paths()) executor = factory.create(launcherPath) # assert actual = executor.__class__.__name__ expected = 'WindowsExecutor' self.assertEqual(actual, expected)