diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-06-19 17:49:15 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-06-19 22:46:44 +0200 |
commit | f57b26b6f44494efc0689724a33780e660e3d795 (patch) | |
tree | 5e9f932be629ffa1aac7bd1c67f5ed17f3e4d0ae /source4 | |
parent | 96f120e2349b855ea34888ad923861e787812827 (diff) | |
download | samba-f57b26b6f44494efc0689724a33780e660e3d795.tar.gz samba-f57b26b6f44494efc0689724a33780e660e3d795.tar.bz2 samba-f57b26b6f44494efc0689724a33780e660e3d795.zip |
ntacls: Raise TestSkipped rather than writing to stdout.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/tests/ntacls.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/source4/scripting/python/samba/tests/ntacls.py b/source4/scripting/python/samba/tests/ntacls.py index c8476dbcc8..4799ac6edd 100644 --- a/source4/scripting/python/samba/tests/ntacls.py +++ b/source4/scripting/python/samba/tests/ntacls.py @@ -20,7 +20,7 @@ from samba.ntacls import setntacl, getntacl, XattrBackendError from samba.dcerpc import xattr, security from samba.param import LoadParm -from unittest import TestCase +from samba.tests import TestCase, TestSkipped import random import os @@ -83,18 +83,17 @@ class NtaclsTests(TestCase): self.assertRaises(XattrBackendError, setntacl, lp, tempf, acl, "S-1-5-21-2212615479-2695158682-2101375467","ttdb", os.path.join(path,"eadbtest.tdb")) def test_setntacl_forcenative(self): - if os.getuid() != 0: - random.seed() - lp = LoadParm() - acl = "O:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375467-512)" - path = os.environ['SELFTEST_PREFIX'] - tempf = os.path.join(path,"pytests"+str(int(100000*random.random()))) - ntacl = xattr.NTACL() - ntacl.version = 1 - open(tempf, 'w').write("empty") - lp.set("posix:eadb", os.path.join(path,"eadbtest.tdb")) - self.assertRaises(Exception, setntacl, lp, tempf ,acl, - "S-1-5-21-2212615479-2695158682-2101375467","native") - os.unlink(tempf) - else: - print "Running test as root, test skipped" + if os.getuid() == 0: + raise TestSkipped("Running test as root, test skipped") + random.seed() + lp = LoadParm() + acl = "O:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375467-512)" + path = os.environ['SELFTEST_PREFIX'] + tempf = os.path.join(path,"pytests"+str(int(100000*random.random()))) + ntacl = xattr.NTACL() + ntacl.version = 1 + open(tempf, 'w').write("empty") + lp.set("posix:eadb", os.path.join(path,"eadbtest.tdb")) + self.assertRaises(Exception, setntacl, lp, tempf ,acl, + "S-1-5-21-2212615479-2695158682-2101375467","native") + os.unlink(tempf) |