Example #1
0
    def test_children_attribute_will_not_allow_deeper_circular_dependencies(self):
        """testing if a CircularDependency error will be raised when the a
        parent Version of a parent Version is set as a children to its grand
        child
        """
        self.kwargs["parent"] = None
        new_version1 = Version(**self.kwargs)
        new_version2 = Version(**self.kwargs)
        new_version3 = Version(**self.kwargs)

        new_version1.parent = new_version2
        new_version2.parent = new_version3

        self.assertRaises(CircularDependencyError, new_version1.children.append, new_version3)
Example #2
0
 def test_parent_attribute_is_working_properly(self):
     """testing if the parent attribute is working properly
     """
     self.kwargs["parent"] = None
     new_version = Version(**self.kwargs)
     self.assertNotEqual(new_version.parent, self.test_version)
     new_version.parent = self.test_version
     self.assertEqual(new_version.parent, self.test_version)
Example #3
0
 def test_parent_attribute_updates_the_children_attribute(self):
     """testing if the parent attribute updates the children attribute of
     the parent Version properly
     """
     self.kwargs["parent"] = None
     new_version = Version(**self.kwargs)
     self.assertNotEqual(new_version.parent, self.test_version)
     new_version.parent = self.test_version
     self.assertTrue(new_version in self.test_version.children)