class AliasTestCase(unittest.TestCase): def setUp(self): testutils.clearDatabase() self.cmd = AliasCmd() def testAdd(self): self.cmd.do_a_add("l t_list") alias = Config.selectBy(name="ALIASES")[0] self.assertEqual(eval(alias.value)["l"], "t_list")
def __init__(self): Cmd.__init__(self) TaskCmd.__init__(self) ProjectCmd.__init__(self) KeywordCmd.__init__(self) AliasCmd.__init__(self) ConfCmd.__init__(self) self.prompt = "yokadi> " self.historyPath = basepaths.getHistoryPath() self.loadHistory()
def __init__(self): Cmd.__init__(self) TaskCmd.__init__(self) ProjectCmd.__init__(self) KeywordCmd.__init__(self) AliasCmd.__init__(self) ConfCmd.__init__(self) self.prompt = "yokadi> " self.historyPath = basepaths.getHistoryPath() self.loadHistory() self.cryptoMgr = cryptutils.YokadiCryptoManager( ) # Load shared cryptographic manager
class AliasTestCase(unittest.TestCase): def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() self.cmd = AliasCmd() def testAdd(self): self.cmd.do_a_add("l t_list") self.cmd.do_a_add("la t_list -a") alias = self.session.query(Config).filter_by(name="ALIASES")[0] self.assertEqual(eval(alias.value)["l"], "t_list") self.cmd.do_a_remove("l") self.cmd.do_a_remove("la") self.cmd.do_a_remove("unknown") self.assertEqual(eval(alias.value), {})
def __init__(self): Cmd.__init__(self) TaskCmd.__init__(self) ProjectCmd.__init__(self) KeywordCmd.__init__(self) AliasCmd.__init__(self) ConfCmd.__init__(self) self.prompt = "yokadi> " self.historyPath = os.getenv("YOKADI_HISTORY") if not self.historyPath: if os.name == "posix": self.historyPath = os.path.join(os.path.expandvars("$HOME"), ".yokadi_history") else: # Windows location self.historyPath = os.path.join(os.path.expandvars("$APPDATA"), ".yokadi_history") self.loadHistory() self.cryptoMgr = cryptutils.YokadiCryptoManager() # Load shared cryptographic manager
def __init__(self): Cmd.__init__(self) TaskCmd.__init__(self) ProjectCmd.__init__(self) KeywordCmd.__init__(self) AliasCmd.__init__(self) ConfCmd.__init__(self) self.prompt = "yokadi> " self.historyPath = os.getenv("YOKADI_HISTORY") if not self.historyPath: if os.name == "posix": self.historyPath = os.path.join(os.path.expandvars("$HOME"), ".yokadi_history") else: # Windows location self.historyPath = os.path.join(os.path.expandvars("$APPDATA"), ".yokadi_history") self.loadHistory() self.cryptoMgr = cryptutils.YokadiCryptoManager( ) # Load shared cryptographic manager
def setUp(self): testutils.clearDatabase() self.cmd = AliasCmd()
def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() self.cmd = AliasCmd()
class AliasTestCase(unittest.TestCase): def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() self.cmd = AliasCmd() def testList(self): self.cmd.do_a_add("b t_add") self.cmd.do_a_add("a t_list") out = StringIO() with redirect_stdout(out): self.cmd.do_a_list("") content = out.getvalue() self.assertEqual(content, colors.BOLD + "a".ljust(10) + colors.RESET + "=> t_list\n" + colors.BOLD + "b".ljust(10) + colors.RESET + "=> t_add\n") def testList_empty(self): out = StringIO() with redirect_stdout(out): self.cmd.do_a_list("") content = out.getvalue() self.assertTrue("No alias defined" in content) def testAdd(self): self.cmd.do_a_add("l t_list") self.cmd.do_a_add("la t_list -a") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases["l"], "t_list") self.cmd.do_a_remove("l") self.cmd.do_a_remove("la") self.cmd.do_a_remove("unknown") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases, {}) def testEditName(self): self.cmd.do_a_add("l t_list") tui.addInputAnswers("ls") self.cmd.do_a_edit_name("l") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases["ls"], "t_list") def testEditCommand(self): self.cmd.do_a_add("l t_list") tui.addInputAnswers("foo") self.cmd.do_a_edit_command("l") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases["l"], "foo")
class AliasTestCase(unittest.TestCase): def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() self.cmd = AliasCmd() def testList(self): self.cmd.do_a_add("b t_add") self.cmd.do_a_add("a t_list") out = StringIO() with redirect_stdout(out): self.cmd.do_a_list("") content = out.getvalue() self.assertEqual( content, C.BOLD + "a".ljust(10) + C.RESET + "=> t_list\n" + C.BOLD + "b".ljust(10) + C.RESET + "=> t_add\n") def testList_empty(self): out = StringIO() with redirect_stdout(out): self.cmd.do_a_list("") content = out.getvalue() self.assertTrue("No alias defined" in content) def testAdd(self): self.cmd.do_a_add("l t_list") self.cmd.do_a_add("la t_list -a") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases["l"], "t_list") self.cmd.do_a_remove("l") self.cmd.do_a_remove("la") self.cmd.do_a_remove("unknown") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases, {}) def testEditName(self): self.cmd.do_a_add("l t_list") tui.addInputAnswers("ls") self.cmd.do_a_edit_name("l") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases["ls"], "t_list") def testEditCommand(self): self.cmd.do_a_add("l t_list") tui.addInputAnswers("foo") self.cmd.do_a_edit_command("l") aliases = Alias.getAsDict(self.session) self.assertEqual(aliases["l"], "foo")