Exemple #1
0
class BugTestCase(unittest.TestCase):
    def setUp(self):
        db.connectDatabase("", memoryDatabase=True)
        self.session = db.getSession()
        setDefaultConfig()
        tui.clearInputAnswers()
        self.cmd = YokadiCmd()

    def testAdd(self):
        tui.addInputAnswers("y", "2", "4", "123")
        self.cmd.do_bug_add("x t1")

        tui.addInputAnswers("n")
        self.cmd.do_bug_add("notExistingProject newBug")

        tasks = self.session.query(Task).all()
        result = [x.title for x in tasks]
        expected = ["t1"]
        self.assertEqual(result, expected)

        kwDict = self.session.query(Task).get(1).getKeywordDict()
        self.assertEqual(kwDict, dict(_severity=2, _likelihood=4, _bug=123))

        for bad_input in ("",  # No project
                          "x"):  # No task name
            self.assertRaises(YokadiException, self.cmd.do_bug_add, bad_input)
Exemple #2
0
class BugTestCase(unittest.TestCase):
    def setUp(self):
        db.connectDatabase("", memoryDatabase=True)
        self.session = db.getSession()
        setDefaultConfig()
        tui.clearInputAnswers()
        self.cmd = YokadiCmd()

    def testAdd(self):
        tui.addInputAnswers("y", "2", "4", "123")
        self.cmd.do_bug_add("x t1")

        tui.addInputAnswers("n")
        self.cmd.do_bug_add("notExistingProject newBug")

        tasks = self.session.query(Task).all()
        result = [x.title for x in tasks]
        expected = ["t1"]
        self.assertEqual(result, expected)

        kwDict = self.session.query(Task).get(1).getKeywordDict()
        self.assertEqual(kwDict, dict(_severity=2, _likelihood=4, _bug=123))

        for bad_input in (
                "",  # No project
                "x"):  # No task name
            self.assertRaises(YokadiException, self.cmd.do_bug_add, bad_input)

    def testEdit(self):
        task = dbutils.addTask("prj", "bug", interactive=False)
        kwDict = dict(_severity=1, _likelihood=2, _bug=3)
        task.setKeywordDict(kwDict)
        self.session.commit()

        tui.addInputAnswers("bug edited", "2", "4", "6")
        self.cmd.do_bug_edit(str(task.id))

        task = dbutils.getTaskFromId(task.id)
        self.assertEqual(task.title, "bug edited")
        kwDict = task.getKeywordDict()
        self.assertEqual(kwDict, dict(_severity=2, _likelihood=4, _bug=6))
Exemple #3
0
class BugTestCase(unittest.TestCase):
    def setUp(self):
        db.connectDatabase("", memoryDatabase=True)
        self.session = db.getSession()
        setDefaultConfig()
        tui.clearInputAnswers()
        self.cmd = YokadiCmd()

    def testAdd(self):
        tui.addInputAnswers("y", "2", "4", "123")
        self.cmd.do_bug_add("x t1")

        tui.addInputAnswers("n")
        self.cmd.do_bug_add("notExistingProject newBug")

        tasks = self.session.query(Task).all()
        result = [x.title for x in tasks]
        expected = ["t1"]
        self.assertEqual(result, expected)

        kwDict = self.session.query(Task).get(1).getKeywordDict()
        self.assertEqual(kwDict, dict(_severity=2, _likelihood=4, _bug=123))

        for bad_input in ("",  # No project
                          "x"):  # No task name
            self.assertRaises(YokadiException, self.cmd.do_bug_add, bad_input)

    def testEdit(self):
        task = dbutils.addTask("prj", "bug", interactive=False)
        kwDict = dict(_severity=1, _likelihood=2, _bug=3)
        task.setKeywordDict(kwDict)
        self.session.commit()

        tui.addInputAnswers("bug edited", "2", "4", "6")
        self.cmd.do_bug_edit(str(task.id))

        task = dbutils.getTaskFromId(task.id)
        self.assertEqual(task.title, "bug edited")
        kwDict = task.getKeywordDict()
        self.assertEqual(kwDict, dict(_severity=2, _likelihood=4, _bug=6))
Exemple #4
0
class BugTestCase(unittest.TestCase):
    def setUp(self):
        testutils.clearDatabase()
        tui.clearInputAnswers()
        self.cmd = YokadiCmd()

    def testAdd(self):
        tui.addInputAnswers("y", "2", "4", "123")
        self.cmd.do_bug_add("x t1")

        tui.addInputAnswers("n")
        self.cmd.do_bug_add("notExistingProject newBug")

        tasks = list(Task.select())
        result = [x.title for x in tasks]
        expected = [u"t1"]
        self.assertEqual(result, expected)

        kwDict = Task.get(1).getKeywordDict()
        self.assertEqual(kwDict, dict(_severity=2, _likelihood=4, _bug=123))

        for bad_input in ("",  # No project
                          "x"):  # No task name
            self.assertRaises(YokadiException, self.cmd.do_bug_add, bad_input)