예제 #1
0
 def test_add_parent_rebase1(self):
     """Adding Parent to root Task, Rebase Root to Parent"""
     root = Task("Root Task")
     pm = ProjMan(root)
     parent = Task("Parent Task")
     pm.add_parent(parent)
     self.assertEqual(parent, pm.root)
예제 #2
0
 def test_add_parent_rebase2(self):
     """Adding Parent to root Task, Makes former root a child to parent"""
     root = Task("Root Task")
     pm = ProjMan(root)
     parent = Task("Parent Task")
     pm.add_parent(parent)
     self.assertIn(root, pm.root.dependants)
예제 #3
0
 def test_add_parent(self):
     """Can Add Parent to Root Task"""
     root = Task("Root Task")
     pm = ProjMan(root)
     parent = Task("Parent Task")
     pm.add_parent(parent)
     self.assertIn(parent, root.prerequisites)
예제 #4
0
 def test_add_child2(self):
     """PM Adding a child implies root is a parent for the child"""
     root = Task("Root Task")
     pm = ProjMan(root)
     child = Task("Child Task")
     pm.add_child(child)
     self.assertIn(root, child.prerequisites)
예제 #5
0
 def test_add_child(self):
     """PM Can add a child"""
     root = Task("Root Task")
     pm = ProjMan(root)
     child = Task("Child Task")
     pm.add_child(child)
     self.assertIn(child, root.dependants)
예제 #6
0
    def test_list_tasks_duplicates(self):
        """Listing all tasks in a project, no duplicates"""
        # Create Root
        root = Task("Root Task")
        # Create Project
        pm = ProjMan(root)
        # Append Children
        child1 = Task("Child Task 1")
        pm.add_child(child1)

        child2 = Task("Child Task 2")
        pm.add_child(child2)

        task_list = pm.list_tasks()
        self.assertEqual(3, len(task_list))
예제 #7
0
    def test_list_tasks(self):
        """Listing all tasks in a project"""
        # Create Root
        root = Task("Root Task")
        # Create Project
        pm = ProjMan(root)
        # Append Children
        child1 = Task("Child Task 1")
        pm.add_child(child1)

        child2 = Task("Child Task 2")
        pm.add_child(child2)

        task_list = pm.list_tasks()
        self.assertTrue(
            root in task_list and
            child1 in task_list and
            child2 in task_list)
예제 #8
0
 def test_init(self):
     """Check Type of ProjMan"""
     pm = ProjMan()
     self.assertIsInstance(pm, ProjMan)
예제 #9
0
 def test_name(self):
     """Can we define a name in the constructor?"""
     project_name = "Some Project Name"
     pm = ProjMan(None, project_name)
     self.assertEqual(project_name, pm.name)
예제 #10
0
 def test_root(self):
     """Can create a new project with a root Task"""
     root = Task("Root Task")
     pm = ProjMan(root)
     self.assertEqual(root, pm.root)