Example #1
0
    def test_split_path(self):
        distributor = YumDistributor()
        test_path = "/a"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 1)
        self.assertTrue(pieces[0], test_path)

        test_path = "/a/"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 1)
        self.assertTrue(pieces[0], test_path)

        test_path = "/a"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 1)
        self.assertTrue(pieces[0], test_path)

        test_path = "a/"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 1)
        self.assertTrue(pieces[0], test_path)

        test_path = "/a/bcde/f/ghi/j"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 5)
        self.assertTrue(os.path.join(*pieces), test_path)

        test_path = "a/bcde/f/ghi/j"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 5)
        self.assertTrue(os.path.join(*pieces), test_path)

        test_path = "a/bcde/f/ghi/j/"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 5)
        self.assertTrue(os.path.join(*pieces), test_path)

        test_path = "/a/bcde/f/ghi/j/"
        pieces = distributor.split_path(test_path)
        self.assertEqual(len(pieces), 5)
        self.assertTrue(os.path.join(*pieces), test_path)