From 1428519372bfdee9521d377a399f3cc0d1dd1283 Mon Sep 17 00:00:00 2001 From: Jule Anger Date: Mon, 19 Aug 2024 11:09:53 +0200 Subject: [PATCH] tests: add test for cli_get_posix_fs_info Signed-off-by: Jule Anger Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Mon Oct 14 08:48:07 UTC 2024 on atb-devel-224 --- python/samba/tests/smb3unix.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index d8e8783670a..302b34776d7 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -490,3 +490,23 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): l = winconn.list('', mask='test_delete_on_close') found_files = {get_string(f['name']): f for f in l} self.assertFalse('test_delete_on_close' in found_files) + + def test_posix_fs_info(self): + """ + Test the posix filesystem attributes list given by cli_get_posix_fs_info. + With a non-posix connection, a NT_STATUS_INVALID_INFO_CLASS error + is expected. + """ + (winconn, posixconn) = self.connections() + + try: + posix_info = posixconn.get_posix_fs_info() + except Exception as e: + self.fail(str(e)) + self.assertTrue(isinstance(posix_info, dict)) + self.assertTrue('optimal_transfer_size' in posix_info) + + with self.assertRaises(NTSTATUSError) as cm: + winconn.get_posix_fs_info() + e = cm.exception + self.assertEqual(e.args[0], ntstatus.NT_STATUS_INVALID_INFO_CLASS)