def canFindCfgOption(): directory = os.path.join(sys.argv[1], ".OpenIDE") file = os.path.join(directory, "test.oicfgoptions") writeToFile(file, "custom.setting|This is a custom setting") tests.out("command|conf list") expected = "custom.setting // This is a custom setting" tests.assertOn(tests.hasOutput(expected))
def canWriteReadGlobalSetting(): # Clean up in case of previous failing test tests.out("command|conf test.globalsetting -g -d") tests.out("command|conf test.globalsetting=20 -g") tests.out("command|conf read -g") tests.assertOn(tests.hasOutput("test.globalsetting=20")) tests.out("command|conf test.globalsetting -g -d")
def canCreateGlobalProfile(): root = "nonexistent" for line in runProcess(["oi", "conf", "read", "rootpoint", "-g"]): root=line profile = os.path.join(root, ".OpenIDE", "active.profile") backup = profile + ".backup" if os.path.exists(profile) == False: profile = None if not profile == None: shutil.copyfile(profile, backup) tests.out("command|profile init new-global-profile -g") tests.out("command|profile load new-global-profile -g") tests.out("command|profile list") if not profile == None: os.remove(profile) shutil.copyfile(backup, profile) os.remove(backup) tests.assertOn(tests.hasOutput("Active global profile: new-global-profile")) tests.out("command|profile rm new-global-profile -g")
def canCreateGlobalProfile(): root = "nonexistent" for line in runProcess(["oi", "conf", "read", "rootpoint", "-g"]): root = line profile = os.path.join(root, ".OpenIDE", "active.profile") backup = profile + ".backup" if os.path.exists(profile) == False: profile = None if not profile == None: shutil.copyfile(profile, backup) tests.out("command|profile init new-global-profile -g") tests.out("command|profile load new-global-profile -g") tests.out("command|profile list") if not profile == None: os.remove(profile) shutil.copyfile(backup, profile) os.remove(backup) tests.assertOn( tests.hasOutput("Active global profile: new-global-profile")) tests.out("command|profile rm new-global-profile -g")
def canAppendToSetting(): tests.out("command|conf test.appendsetting=hei") tests.out("command|conf test.appendsetting+=ja") tests.out("command|conf read") tests.assertOn(tests.hasOutput("test.appendsetting=hei,ja"))
def canReadRootPoint(): root = sys.argv[1] tests.out("command|conf read rootpoint") tests.assertOn(tests.hasOutput(root))
def canFailTest(): root = os.path.dirname(__file__) tests.out("command|pkgtest " + os.path.join(root, "pkgtest.failed.test.py")) tests.assertOn(tests.hasOutput("FAILED A failing test"))
def canReadGlobalRootPoint(): root = tests.get("applocation") tests.out("command|conf read rootpoint -g") tests.assertOn(tests.hasOutput(root))
def canReadGlobalCfgFile(): root = tests.get("applocation") file = os.path.join(os.path.join(root, ".OpenIDE"), "oi.config") tests.out("command|conf read cfgfile -g") tests.assertOn(tests.hasOutput(file))
def canRemoveGlobalSetting(): tests.out("command|conf test.globalremovedsetting=34 -g") tests.out("command|conf test.globalremovedsetting -g -d") tests.out("command|conf read -g") tests.assertOn(tests.hasOutput("test.globalremovedsetting=34") == False)
def canReadGlobalCfgPoint(): cfgfile = os.path.join(tests.get("applocation"), ".OpenIDE") tests.out("command|conf read cfgpoint -g") tests.assertOn(tests.hasOutput(cfgfile))
def canCreateLocalProfile(): tests.out("command|profile init new-local-profile") tests.out("command|profile load new-local-profile") tests.out("command|profile list") tests.assertOn(tests.hasOutput("Active local profile: new-local-profile"))
def canMarkTestAsInconclusuve(): root = os.path.dirname(__file__) tests.out("command|pkgtest " + os.path.join(root, "pkgtest.inconclusive.test.py")) tests.assertOn(tests.hasOutput("?????? A inconclusive test"))
def canRemoveFromSetting(): tests.out("command|conf test.reducedsetting=hei,men,ja") tests.out("command|conf test.reducedsetting-=men") tests.out("command|conf read") tests.assertOn(tests.hasOutput("test.reducedsetting=hei,ja"))
def canReadout(): tests.out("command|conf test.setting=34") tests.out("command|conf read test.setting") tests.assertOn(tests.hasOutput("34"))
def canFindLocalCfgFile(): cfgfile = os.path.join(os.path.join(sys.argv[1], ".OpenIDE"), "oi.config") tests.out("command|conf read cfgfile") tests.assertOn(tests.hasOutput(cfgfile))
def canPassTest(): root = os.path.dirname(__file__) tests.out("command|pkgtest " + os.path.join(root, "pkgtest.passing.test.py")) tests.assertOn(tests.hasOutput("PASSED A passing test"))
def canReadCfgPoint(): cfgfile = os.path.join(sys.argv[1], ".OpenIDE") tests.out("command|conf read cfgpoint") tests.assertOn(tests.hasOutput(cfgfile))
def canRemoveSetting(): tests.out("command|conf test.removedsetting=34") tests.out("command|conf test.removedsetting -d") tests.out("command|conf read") tests.assertOn(tests.hasOutput("test.removedsetting=34") == False)