def test_open_success(self, mock_open): """Function: test_open_success Description: Test with file open returning successful. Arguments: """ mock_open.return_value = self.open self.assertFalse( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno, self.strerror, self.exit_flag))
def test_open_fail2(self): """Function: test_open_fail2 Description: Test with no -f in file_crt_list list. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list2, self.errno, self.strerror, self.status))
def test_open_fail3(self): """Function: test_open_fail3 Description: Test with unable to open file to write. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name2, self.option, self.file_crt_list, self.errno, self.strerror, self.status))
def test_open_success(self): """Function: test_open_success Description: Test with file open returning successful. Arguments: """ self.assertFalse( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno, self.strerror, self.status)) self.assertTrue(os.path.isfile(self.name))
def test_open_fail(self): """Function: test_open_fail Description: Test with errno set to non-two value. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno2, self.strerror, self.status))
def test_option_not_in_list(self): """Function: test_option_not_in_list Description: Test with option not being in file_crt_list. Arguments: """ self.option = "-a" with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno, self.strerror, self.exit_flag))
def test_errno_not_two(self): """Function: test_errno_not_two Description: Test with errno not set to two. Arguments: """ self.errno = 10 with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno, self.strerror, self.exit_flag))
def test_open_fail(self, mock_open): """Function: test_open_fail Description: Test with file open returning failure. Arguments: """ mock_open.return_value = self.open2 with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno, self.strerror, self.exit_flag))