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
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
class KeywordTestCase(unittest.TestCase): def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() tui.clearInputAnswers() self.cmd = KeywordCmd() def testKEditNoMerge(self): t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("newk1") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assertTrue("k1" not in kwDict) self.assertEqual(kwDict.get("newk1"), 12) self.assertRaises(YokadiException, dbutils.getKeywordFromName, "k1") def testKEditMerge(self): t1 = dbutils.addTask("x", "t1", dict(k1=None, k2=None), interactive=False) t2 = dbutils.addTask("x", "t2", dict(k1=None), interactive=False) tui.addInputAnswers("k2", "y") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assertTrue("k1" not in kwDict) self.assertTrue("k2" in kwDict) kwDict = t2.getKeywordDict() self.assertTrue("k1" not in kwDict) self.assertTrue("k2" in kwDict) self.assertRaises(YokadiException, dbutils.getKeywordFromName, "k1") def testKEditCannotMerge(self): """ One can't merge keywords if they have different values """ t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("k2", "y") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assertTrue("k1" in kwDict) self.assertTrue("k2" in kwDict) dbutils.getKeywordFromName("k1") def testKRemove(self): t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("y") self.cmd.do_k_remove("k1") kwDict = t1.getKeywordDict() self.assertFalse("k1" in kwDict) self.assertTrue("k2" in kwDict) taskKeyword = self.session.query(db.TaskKeyword).filter_by(taskId=t1.id).one() self.assertEqual(taskKeyword.keyword.name, "k2")
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
class KeywordTestCase(unittest.TestCase): def setUp(self): testutils.clearDatabase() tui.clearInputAnswers() self.cmd = KeywordCmd() def testKEditNoMerge(self): t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("newk1") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assert_("k1" not in kwDict) self.assertEqual(kwDict.get("newk1"), 12) self.assertRaises(YokadiException, dbutils.getKeywordFromName, "k1") def testKEditMerge(self): t1 = dbutils.addTask("x", "t1", dict(k1=None, k2=None), interactive=False) t2 = dbutils.addTask("x", "t2", dict(k1=None), interactive=False) tui.addInputAnswers("k2", "y") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assert_("k1" not in kwDict) self.assert_("k2" in kwDict) kwDict = t2.getKeywordDict() self.assert_("k1" not in kwDict) self.assert_("k2" in kwDict) self.assertRaises(YokadiException, dbutils.getKeywordFromName, "k1") def testKEditCannotMerge(self): """ One can't merge keywords if they have different values """ t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("k2", "y") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assert_("k1" in kwDict) self.assert_("k2" in kwDict) dbutils.getKeywordFromName("k1")
def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() tui.clearInputAnswers() self.cmd = KeywordCmd()
class KeywordTestCase(unittest.TestCase): def setUp(self): db.connectDatabase("", memoryDatabase=True) self.session = db.getSession() tui.clearInputAnswers() self.cmd = KeywordCmd() def testKEditNoMerge(self): t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("newk1") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assertTrue("k1" not in kwDict) self.assertEqual(kwDict.get("newk1"), 12) self.assertRaises(YokadiException, dbutils.getKeywordFromName, "k1") def testKEditMerge(self): t1 = dbutils.addTask("x", "t1", dict(k1=None, k2=None), interactive=False) t2 = dbutils.addTask("x", "t2", dict(k1=None), interactive=False) tui.addInputAnswers("k2", "y") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assertTrue("k1" not in kwDict) self.assertTrue("k2" in kwDict) kwDict = t2.getKeywordDict() self.assertTrue("k1" not in kwDict) self.assertTrue("k2" in kwDict) self.assertRaises(YokadiException, dbutils.getKeywordFromName, "k1") def testKEditCannotMerge(self): """ One can't merge keywords if they have different values """ t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("k2", "y") self.cmd.do_k_edit("k1") kwDict = t1.getKeywordDict() self.assertTrue("k1" in kwDict) self.assertTrue("k2" in kwDict) dbutils.getKeywordFromName("k1") def testKRemove(self): t1 = dbutils.addTask("x", "t1", dict(k1=12, k2=None), interactive=False) tui.addInputAnswers("y") self.cmd.do_k_remove("k1") kwDict = t1.getKeywordDict() self.assertFalse("k1" in kwDict) self.assertTrue("k2" in kwDict) taskKeyword = self.session.query( db.TaskKeyword).filter_by(taskId=t1.id).one() self.assertEqual(taskKeyword.keyword.name, "k2")
def setUp(self): testutils.clearDatabase() tui.clearInputAnswers() self.cmd = KeywordCmd()