def tttest_setClearVocolaCommandFilesEditor(self): """This option should set or clear the vocola command files editor """ testName = 'test_setClearVocolaCommandFilesEditor' key = "VocolaCommandFilesEditor" cli = natlinkconfigfunctions.CLI() old = self.testinisection.get(key, None) # not a valid folder: cli.do_w("not a valid file") self.checkusertestinifile( key, old, "%s, nothing should be changed yet" % testName) # change to notepad: wordpad = os.path.join( natlinkcorefunctions.getExtendedEnv("PROGRAMFILES"), 'Windows NT', Accessories, "wordpad.exe") if not os.path.isfile(wordpad): raise IOError("Test error, cannot find wordpad on: %s" % wordpad) cli.do_w(wordpad) self.checkusertestinifile( key, wordpad, "%s, VocolaCommandFilesEditor should be changed now" % testName) # now clear: cli.do_W("dummy") self.checkusertestinifile( key, None, "%s VocolaUserDirectory should be cleared now" % testName)
def tttest_setClearDNSInstallDir(self): """This option should set or clear the natspeak install directory """ key = "DNSInstallDir" cli = natlinkconfigfunctions.CLI() old = self.testinisection.get(key, None) # not a valid folder: cli.do_d("notAValidFolder") self.checkusertestinifile( key, old, "DNSInstallDir, nothing should be changed yet") # folder does not have Programs: cli.do_d(self.tmpTest) self.checkusertestinifile( key, old, "DNSInstallDir, empty directory should not change DNSInstallDir") # now change: programDir = os.path.join(self.tmpTest, 'Program') os.mkdir(programDir) cli.do_d(self.tmpTest) self.checkusertestinifile(key, self.tmpTest, "DNSInstallDir should be changed now") # now clear: cli.do_D("dummy") self.checkusertestinifile(key, None, "DNSInstallDir should be cleared now")
def tttest_enableDisableNatlinkDebugOutput(self): """This option should set DebugOutput in the registry to 0 or 1 obsolete, NatlinkDebug is disabled (2015, even earlier, by Rudiger) """ key = "NatlinkDebug" cli = natlinkconfigfunctions.CLI() cli.do_g("dummy") self.checkusertestinifile(key, 0, "key %s not set, obsolete option"% key) cli.do_G("dummy") self.checkusertestinifile(key, 0, "key %s not set, obsolete option"% key) cli.do_g("dummy") self.checkusertestinifile(key, 0, "key %s not set, obsolete option"% key)
def tttest_setClearVocolaUserDirectory(self): """This option should set or clear the vocola user directory """ testName = 'test_setClearVocolaUserDirectory' key = "VocolaUserDirectory" cli = natlinkconfigfunctions.CLI() old = self.testinisection.get(key, None) # not a valid folder: cli.do_v("notAValidFolder") self.checkusertestinifile(key, old, "%s, nothing should be changed yet"% testName) # change userdirectory cli.do_v(self.tmpTest) self.checkusertestinifile(key, self.tmpTest, "%s, VocolaUserDirectory should be changed now"% testName) # now clear: cli.do_V("dummy") self.checkusertestinifile(key, None, "%s VocolaUserDirectory should be cleared now"% testName)
def setUp(self): """define self.tmpTest (in TMP) and vocolausertest and unimacrousertest in HOME directory raise TestError if HOME is not existent, or one of these directories already exist """ ## testfolder: tmp = natlinkcorefunctions.getExtendedEnv("TMP") tmpTest = os.path.join(tmp, 'testconfig') if not os.path.isdir(tmp): raise TestError('test error, not a valid tmp folderpath: %s'% tmp) if os.path.exists(tmpTest): shutil.rmtree(tmpTest) if os.path.exists(tmpTest): raise TestError('test error, test path should not be there: %s'% tmpTest) os.mkdir(tmpTest) homeDir = isValidPath("~") if homeDir: vocolausertest = os.path.join(homeDir, "vocolausertest") if not isValidPath(vocolausertest): os.mkdir(vocolausertest) self.vocolausertest = vocolausertest unimacrousertest = os.path.join(homeDir, "unimacrousertest") if not isValidPath(unimacrousertest): os.mkdir(unimacrousertest) self.unimacrousertest = unimacrousertest else: raise TestError("home directory not defined: %s") self.assertTrue(os.path.isdir(tmpTest), "Could not make test folder: %s"% tmpTest) # self.tmpTest to test directory things safely: self.tmpTest = tmpTest self.cli = natlinkconfigfunctions.CLI() config = self.cli.config config.userregnl = NatlinkstatusTestInifileSection() config.userregnl.clear() self.testinisection = config.userregnl