def test_should_not_delete_directory_because_directory_exist_but_has_content(self): dir_create(test_path) file_path = test_path + '/test_file.txt' file_save(File(file_path, 'Test content'), append=False) dir_delete(test_path, force=False) self.assertTrue(is_dir_exist(test_path)) self.assertTrue(file_exist(file_path))
def test_should_delete_directory_with_success_with_content(self): dir_create(test_path) file_path = test_path + '/test_file.txt' file_save(File(file_path, 'Test content'), append=False) dir_delete(test_path, force=True) self.assertFalse(is_dir_exist(file_path)) self.assertFalse(file_exist(file_path))
def test_should_file_save_create_new_file_if_not_exist(self): path = '/tmp/another_test_file' content = 'File created once not exist' delete_tmp_file(path) file_save(File(path, content)) self.assertTrue(file_exist(path)) self.assertEqual(file_load(path).content, content) delete_tmp_file(path)
def test_should_return_False_if_file_not_exist(self): result = file_exist(file_path) self.assertFalse(result)
def test_should_return_True_if_file_exist(self): path = create_tmp_file() result = file_exist(path) self.assertTrue(result)