def test_console_is_enabled(self): emu = mock() valid = model.Console("Nintendo", "NES", "", "", "", "", "", emu) self.assertTrue(consoles.console_is_enabled(valid)) invalid = model.Console("Nintendo", "NES", "", "", "", "", "", None) self.assertFalse(consoles.console_is_enabled(invalid))
def test_verify(self): emu = mock() adapter = console_adapter.ConsoleBackedObjectAdapter([]) valid = model.Console("Nintendo", "NES", "", "", "", "", "", emu) self.assertTrue(adapter.verify(valid)) invalid = model.Console("Nintendo", "NES", "", "", "", "", "", None) self.assertFalse(adapter.verify(invalid))
def new(self, backing_store, identifier): fullname = identifier shortname = backing_store.get(identifier, 'nickname', fullname) extensions = backing_store.get(identifier, 'extensions', "") custom_roms_directory = backing_store.get(identifier, 'roms directory', "") prefix = backing_store.get(identifier, 'prefix', "") icon = backing_store.get(identifier, 'icon', "") images_directory = backing_store.get(identifier, 'images directory', "") emulator_identifier = backing_store.get(identifier, 'emulator', "") icon = os.path.expanduser(icon) custom_roms_directory = os.path.expanduser(custom_roms_directory) images_directory = os.path.expanduser(images_directory) emulator = self.emulators.find(emulator_identifier) return model.Console( fullname, shortname, extensions, custom_roms_directory, prefix, icon, images_directory, emulator, )
def test_rom_shortcut_name(self, name, console_prefix, expected): console = model.Console( fullname='Nintendo Entertainment System', shortname='NES', extensions='', custom_roms_directory='', prefix=console_prefix, icon='', images_directory='', emulator=None, ) rom = model.ROM(name=name, path='/Path/to/ROM', console=console) self.assertEqual(roms.rom_shortcut_name(rom), expected)
def _dummy_console(self, extensions, emu, roms_directory=""): return model.Console("Nintendo", "NES", extensions, roms_directory, "", "", "", emu)
def test_path_is_rom(self, extensions, path, expected): console = model.Console("Nintendo", "NES", extensions, "", "", "", "", None) self.assertEqual(consoles.path_is_rom(console, path), expected)
return DataPseudoClass(**data) emulators = DataFixture({ "mednafen": model.Emulator(name='Mednafen', location='/emulators/Mednafen/mednafen', format="%l %r"), }) consoles = DataFixture({ "nes": model.Console(fullname='Nintendo Entertainment System', shortname='NES', extensions='nes', custom_roms_directory='', prefix='[NES]', icon='/consoles/icons/nes.png', images_directory='/consoles/grid/nes/', emulator=emulators.mednafen), "snes": model.Console(fullname='Super Nintendo', shortname='SNES', extensions='snes', custom_roms_directory='/external/consoles/roms/snes', prefix='', icon='/consoles/icons/snes.png', images_directory='/consoles/grid/snes/', emulator=emulators.mednafen), # HACK: We're cheating a bit here. For a tiny while Ice would automatically # add an extra category to shortcuts to let itself know whether it should be # responsibile for removing said shortcut if the exe went missing. We don't