예제 #1
0
파일: main.py 프로젝트: kotenev/yokadi
 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()
예제 #2
0
파일: main.py 프로젝트: agateau/yokadi
 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()
예제 #3
0
파일: main.py 프로젝트: semtle/yokadi
 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
예제 #4
0
파일: main.py 프로젝트: hswick/yokadi
 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
예제 #5
0
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")
예제 #6
0
파일: main.py 프로젝트: bport/yokadi
 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
예제 #7
0
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")
예제 #8
0
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")
예제 #9
0
 def setUp(self):
     db.connectDatabase("", memoryDatabase=True)
     self.session = db.getSession()
     tui.clearInputAnswers()
     self.cmd = KeywordCmd()
예제 #10
0
 def setUp(self):
     db.connectDatabase("", memoryDatabase=True)
     self.session = db.getSession()
     tui.clearInputAnswers()
     self.cmd = KeywordCmd()
예제 #11
0
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")
예제 #12
0
 def setUp(self):
     testutils.clearDatabase()
     tui.clearInputAnswers()
     self.cmd = KeywordCmd()
예제 #13
0
 def setUp(self):
     testutils.clearDatabase()
     tui.clearInputAnswers()
     self.cmd = KeywordCmd()