From: Volker Lendecke Date: Wed, 1 Nov 2023 14:38:55 +0000 (+0100) Subject: tests: Make clean_file() handle directories X-Git-Tag: talloc-2.4.2~870 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9dd5e12cfa46fe5e9c3653f2e85d0a7f9c59e74c;p=thirdparty%2Fsamba.git tests: Make clean_file() handle directories Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/smb2symlink.py b/python/samba/tests/smb2symlink.py index 81e75718f82..3ac35e52c09 100644 --- a/python/samba/tests/smb2symlink.py +++ b/python/samba/tests/smb2symlink.py @@ -59,7 +59,10 @@ class Smb2SymlinkTests(samba.tests.libsmb.LibsmbTests): try: conn.unlink(filename) except NTSTATUSError as e: - if e.args[0] != ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND: + if e.args[0] == ntstatus.NT_STATUS_FILE_IS_A_DIRECTORY: + conn.rmdir(filename) + elif not (e.args[0] == ntstatus.NT_STATUS_OBJECT_NAME_NOT_FOUND or + e.args[0] == ntstatus.NT_STATUS_OBJECT_PATH_NOT_FOUND): raise def create_symlink(self, conn, target, symlink):