def testInstallWineVersion(self): time.sleep(2) ServiceManagerGetter().init( "com.playonlinux.contexts.WineVersionServicesContext") setupWizard = SetupWizard("Mock setup wizard") setupWizard.init() wineVersionManager = ServiceManagerGetter.serviceManager.getService( WineVersionManager) while (wineVersionManager.isUpdating()): print "Updating wine version list..." time.sleep(2) if (wineVersionManager.hasFailed()): raise Exception("Failed to download the list of wineversions") wineInstallation = WineVersion("1.7.36", "upstream-x86", setupWizard) wineInstallation.install() installationPath = "%s/engines/wine/upstream-%s-x86/1.7.36/bin/wine" %\ (Environment.getUserRoot(), OperatingSystem.fetchCurrentOperationSystem().getNameForWinePackages()) ServiceManagerGetter.serviceManager.shutdown() print "Checking that wine binary is installed in %s" % installationPath self.assertTrue(os.path.exists(installationPath))
def testInstallWineVersion(self): time.sleep(2) ServiceManagerGetter().init("com.playonlinux.contexts.WineVersionServicesContext") setupWizard = SetupWizard("Mock setup wizard") setupWizard.init() wineVersionManager = ServiceManagerGetter.serviceManager.getService(WineVersionManager) while(wineVersionManager.isUpdating()): print "Updating wine version list..." time.sleep(2) if(wineVersionManager.hasFailed()): raise Exception("Failed to download the list of wineversions") wineInstallation = WineVersion("1.7.36", "upstream-x86", setupWizard) wineInstallation.install() installationPath = "%s/engines/wine/upstream-%s-x86/1.7.36/bin/wine" %\ (Environment.getUserRoot(), OperatingSystem.fetchCurrentOperationSystem().getWinePackage()) ServiceManagerGetter.serviceManager.shutdown() print "Checking that wine binary is installed in %s" % installationPath self.assertTrue(os.path.exists(installationPath))
def testCreateShortcut(self): setupWizard = SetupWizard("Mock setup wizard") setupWizard.init() WineShortcut.wizard(setupWizard).withName("Shortcut name")\ .withExecutableName("winecfg")\ .withArguments(["argument 1", "argument 2"])\ .withWineDebug("-all")\ .withWorkingDirectory("Working directory")\ .withWinePrefix("Wine prefix")\ .create() shortcuts = Environment.getShortcutsPath() shortcut = os.path.join(shortcuts, "Shortcut name") shortcutFileContent = open(shortcut, "r").read() shortcutJson = json.loads(shortcutFileContent) self.assertEquals("com.playonlinux.library.shortcuts.WineShortcut", shortcutJson["@class"]) self.assertEquals("-all", shortcutJson["wineDebug"]) self.assertEquals("Wine prefix", shortcutJson["winePrefix"]) self.assertEquals("Working directory", shortcutJson["workingDirectory"]) self.assertEquals("winecfg", shortcutJson["executableName"]) self.assertEquals("argument 1", shortcutJson["arguments"][0]) self.assertEquals("argument 2", shortcutJson["arguments"][1]) setupWizard.close()
def setup(setupWindowNetcatServer): os.environ["PLAYONLINUX"] = os.path.realpath(os.path.join(os.path.dirname(__file__), "../", "../" "bash")) os.environ["POL_PORT"] = str(setupWindowNetcatServer.getPort()) os.environ["POL_COOKIE"] = setupWindowNetcatServer.getCookie() os.environ["POL_OS"] = Environment.getOperatinSystem().fetchLegacyName() os.environ["POL_USER_ROOT"] = Environment.getUserRoot() os.environ["AMD64_COMPATIBLE"] = str(Environment.getArchitecture().name() == "AMD64").upper() os.environ["PATH"] = Environment.getPath() os.environ["LD_LIBRARY_PATH"] = Environment.getLibraryPath() os.environ["DYLD_LIBRARY_PATH"] = Environment.getDyldLibraryPath()
def main(self): print "Removing a file in playonlinux root" Files().mkdir(Environment.getUserRoot() + "/test").remove(Environment.getUserRoot() + "/test") print "Removing a file outside playonlinux root" Files().mkdir("/tmp/test").remove("/tmp/test")
def testRemoveAFileInsidePlayOnLinuxRoot(self): Files().mkdir(Environment.getUserRoot() + "/test").remove(Environment.getUserRoot() + "/test")