mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
python: tests: Add tests for samba.posix_eadb module
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Nov 8 21:54:59 CET 2017 on sn-devel-144
This commit is contained in:
committed by
Andreas Schneider
parent
e00ba05d33
commit
de5e23c236
@ -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):
|
||||
|
||||
|
Reference in New Issue
Block a user