From: Björn Baumbach Date: Wed, 12 Feb 2025 16:15:37 +0000 (+0100) Subject: pytests: test pysmbd with non-existent file X-Git-Tag: tevent-0.17.0~765 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=334f621e4b74e9cda735982e223aefc7eefb4631;p=thirdparty%2Fsamba.git pytests: test pysmbd with non-existent file BUG: https://bugzilla.samba.org/show_bug.cgi?id=15807 Signed-off-by: Björn Baumbach Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/samba_tool/ntacl.py b/python/samba/tests/samba_tool/ntacl.py index 11731011e95..414ff982bf7 100644 --- a/python/samba/tests/samba_tool/ntacl.py +++ b/python/samba/tests/samba_tool/ntacl.py @@ -22,6 +22,7 @@ import os from samba.tests.samba_tool.base import SambaToolCmdTest from samba.tests import env_loadparm import random +import secrets class NtACLCmdSysvolTestCase(SambaToolCmdTest): @@ -123,6 +124,24 @@ class NtACLCmdGetSetTestCase(SambaToolCmdTest): self.assertEqual(err, "", "Shouldn't be any error messages") self.assertEqual(out, "", "Shouldn't be any output messages") + def test_set_expect_file_not_found(self): + path = os.environ['SELFTEST_PREFIX'] + tempf_basename = f"{self.unique_name()}-{secrets.token_hex(10)}" + tempf = os.path.join(path, tempf_basename) + + for fs_arg in ["--use-s3fs", "--use-ntvfs"]: + (result, out, err) = self.runsubcmd("ntacl", + "set", + self.acl, + tempf_basename, + fs_arg) + + self.assertCmdFail(result, "succeeded with non-existent file") + self.assertIn("No such file or directory", + err, + "No such file or directory expected") + self.assertEqual(out, "", "Shouldn't be any output messages") + def test_ntvfs_check(self): path = os.environ['SELFTEST_PREFIX'] tempf = os.path.join(path, "pytests" + str(int(100000 * random.random())))