예제 #1
0
    def test_fail_else(self):
        """Function:  test_fail_else

        Description:  Test failure for if statement else clause.

        Arguments:

        """

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir2,
                                           self.cp_file_dir, self.dest_file)),
                         (False, "No such file or directory"))
예제 #2
0
    def test_cp_file(self):
        """Function:  test_cp_file

        Description:  Test copy of file in same directory.

        Arguments:

        """

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir,
                                           self.cp_file_dir, self.dest_file)),
                         (True, None))
예제 #3
0
    def test_fail_dest_dir(self):
        """Function:  test_fail_dest_dir

        Description:  Test failure on missing destination directory.

        Arguments:

        """

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir,
                                           self.cp_file_dir2, self.dest_file)),
                         (False, self.err_mask % (self.cp_file_dir2)))
예제 #4
0
    def test_cp_file_diff(self):
        """Function:  test_cp_file_diff

        Description:  Test copy of file to different name.

        Arguments:

        """

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir,
                                           self.cp_file_dir, self.dest_file)),
                         (True, None))
예제 #5
0
    def test_fail_src_file(self):
        """Function:  test_fail_src_file

        Description:  Test failure on missing source file.

        Arguments:

        """

        self.assertEqual((gen_libs.cp_file(self.dest_file, self.cp_file_dir,
                                           self.cp_file_dir, self.src_file)),
                         (False, self.err_mask %
                          (os.path.join(self.cp_file_dir, self.dest_file))))
예제 #6
0
    def test_cp_file_same(self):
        """Function:  test_cp_file_same

        Description:  Test copy of file to same name.

        Arguments:

        """

        gen_libs.touch(os.path.join(self.cp_file_dir2, "testme"))

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir,
                                           self.cp_file_dir2)), (True, None))
예제 #7
0
    def test_cp_file_dir(self):
        """Function:  test_cp_file_dir

        Description:  Test copy of file in different directory.

        Arguments:

        """

        gen_libs.touch(os.path.join(self.cp_file_dir2, "testme"))

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir,
                                           self.cp_file_dir2, self.dest_file)),
                         (True, None))
예제 #8
0
    def test_fail_dest_perm(self):
        """Function:  test_fail_dest_perm

        Description:  Test failure on directory permission.

        Arguments:

        """

        gen_libs.touch(os.path.join(self.cp_file_dir2, self.src_file))
        os.chmod(self.cp_file_dir2, 0444)

        self.assertEqual((gen_libs.cp_file(self.src_file, self.cp_file_dir,
                                           self.cp_file_dir2, self.dest_file)),
                         (False, "Permission denied"))