def test_solver_shouldfail_01(self):
        links = []
        links.append(LinkMock("aaa", "bbb"))
        links.append(LinkMock("ccc", "ddd"))

        logger = logging.getLogger("testloger")
        solver = Solver(links, "aaa", "ccc", logger=logger)
        resolved_path = solver.solve()
        self.assertFalse(resolved_path)
示例#2
0
    def test_solver_shouldfail_01(self):
        links = []
        links.append(LinkMock("aaa", "bbb"))
        links.append(LinkMock("ccc", "ddd"))

        logger = logging.getLogger("testloger")
        solver = Solver(links, "aaa", "ccc", logger=logger)
        resolved_path = solver.solve()
        self.assertFalse(resolved_path)
    def test_solver_02(self):
        links = []
        links.append(LinkMock("aaa", "bbb"))
        links.append(LinkMock("bbb", "ccc"))

        logger = logging.getLogger("testloger")
        solver = Solver(links, "aaa", "ccc", logger=logger)
        resolved_path = solver.solve()
        self.assertTrue(resolved_path)
        self.assertEqual(self.path_to_strlist(resolved_path),
                         ["aaa", "bbb", "ccc"])
示例#4
0
    def test_solver_02(self):
        links = []
        links.append(LinkMock("aaa", "bbb"))
        links.append(LinkMock("bbb", "ccc"))

        logger = logging.getLogger("testloger")
        solver = Solver(links, "aaa", "ccc", logger=logger)
        resolved_path = solver.solve()
        self.assertTrue(resolved_path)
        self.assertEqual(self.path_to_strlist(resolved_path),
                         ["aaa", "bbb", "ccc"])
    def test_solver_graph_build(self):
        links = []
        links.append(LinkMock("aaa", "bbb"))
        links.append(LinkMock("aaa", "ccc"))
        links.append(LinkMock("bbb", "ccc"))

        logger = logging.getLogger("testloger")
        graph = Solver.Graph()
        graph.graph_from_links(links)

        self.assertTrue(graph)
        self.assertEqual(len(graph.nodes), 3)
        self.assertTrue("aaa" in graph.nodes)
        self.assertTrue("bbb" in graph.nodes)
        self.assertTrue("ccc" in graph.nodes)

        self.assertEqual(len(graph.nodes["aaa"].targets), 2)
        self.assertEqual(len(graph.nodes["bbb"].targets), 1)
        self.assertEqual(len(graph.nodes["ccc"].targets), 0)

        self.assertEqual(len(graph.nodes["aaa"].sources), 0)
        self.assertEqual(len(graph.nodes["bbb"].sources), 1)
        self.assertEqual(len(graph.nodes["ccc"].sources), 2)
 def test_solver_shouldfail_03(self):
     links = []
     links.append(LinkMock("aaa", "bbb"))
     logger = logging.getLogger("testloger")
     solver = Solver(links, "ccc", "aaa", logger=logger)
     self.assertRaises(DeltaRepoError, solver.solve)