From: Lumir Balhar Date: Tue, 24 Oct 2017 07:01:16 +0000 (+0200) Subject: python: tests: Add tests for samba.posix_eadb module X-Git-Tag: tevent-0.9.34~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de5e23c236013d35625d296ea00c6206d55330aa;p=thirdparty%2Fsamba.git python: tests: Add tests for samba.posix_eadb module Signed-off-by: Lumir Balhar Reviewed-by: Andrew Bartlet Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Wed Nov 8 21:54:59 CET 2017 on sn-devel-144 --- diff --git a/python/samba/tests/xattr.py b/python/samba/tests/xattr.py index 63874523f00..b024175a8d6 100644 --- a/python/samba/tests/xattr.py +++ b/python/samba/tests/xattr.py @@ -17,7 +17,7 @@ """Tests for samba.xattr_native and samba.xattr_tdb.""" -import samba.xattr_native, samba.xattr_tdb +import samba.xattr_native, samba.xattr_tdb, samba.posix_eadb from samba.xattr import copytree_with_xattrs from samba.dcerpc import xattr from samba.ndr import ndr_pack @@ -108,6 +108,34 @@ class XattrTests(TestCase): os.unlink(tempf) os.unlink(eadb_path) + def test_set_posix_eadb(self): + tempf = self._tmpfilename() + eadb_path = self._eadbpath() + ntacl = xattr.NTACL() + ntacl.version = 1 + open(tempf, 'w').write("empty") + try: + samba.posix_eadb.wrap_setxattr(eadb_path, + tempf, "user.unittests", ndr_pack(ntacl)) + finally: + os.unlink(tempf) + os.unlink(eadb_path) + + def test_set_and_get_posix_eadb(self): + tempf = self._tmpfilename() + eadb_path = self._eadbpath() + reftxt = "this is a test" + open(tempf, 'w').write("empty") + try: + samba.posix_eadb.wrap_setxattr(eadb_path, tempf, "user.unittests", + reftxt) + text = samba.posix_eadb.wrap_getxattr(eadb_path, tempf, + "user.unittests") + self.assertEquals(text, reftxt) + finally: + os.unlink(tempf) + os.unlink(eadb_path) + class TestCopyTreeWithXattrs(TestCaseInTempDir):