Esempio n. 1
0
    def test_cp_rm(self):
        src = os.path.join(self.shell, "src")
        dst = os.path.join(self.shell, "dst")

        src_file = os.path.join(self.shell, "src.txt")
        dst_file = os.path.join(self.shell, "dst.txt")

        self.assertTrue(os.path.exists(src))
        self.assertTrue(os.path.exists(src_file))

        self.assertFalse(os.path.exists(dst))
        self.assertFalse(os.path.exists(dst_file))

        print("")

        main.cp(src, dst)
        main.cp(src_file, dst_file)

        self.assertTrue(os.path.exists(dst))
        self.assertTrue(os.path.exists(dst_file))

        self.assertEqual(main.diff(src, dst), "")
        self.assertEqual(main.diff(src_file, dst_file), "")

        main.rm(dst)
        main.rm(dst_file)

        self.assertFalse(os.path.exists(dst))
        self.assertFalse(os.path.exists(dst_file))

        print("")
Esempio n. 2
0
    def test_files_differ_files(self):
        outb = main.diff(os.path.join(self.root, "src.txt"),
                         os.path.join(self.root, "dst.txt"))

        self.assertEqual(outb, "")

        outb = main.diff(os.path.join(self.root, "src.txt"),
                         os.path.join(self.root, "differ.txt"))

        self.differ_files_helper(outb)

        outb = main.diff(os.path.join(self.root, "differ.txt"),
                         os.path.join(self.root, "src.txt"))

        self.differ_files_helper(outb)
Esempio n. 3
0
    def test_files_differ_folder(self):
        outb = main.diff(self.src, self.tar)
        self.differ_folder_helper(outb)

        outb = main.diff(self.tar, self.src)
        self.differ_folder_helper(outb)
Esempio n. 4
0
    def test_differ_empty(self):
        with self.assertRaises(AssertionError):
            main.diff(self.src, "")

        with self.assertRaises(AssertionError):
            main.diff("", self.tar)
Esempio n. 5
0
    def test_only_in(self):
        outb = main.diff(self.src, self.tar)
        self.only_in_helper(outb)

        outb = main.diff(self.tar, self.src)
        self.only_in_helper(outb)