summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-07-04 15:35:14 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-07-12 04:32:03 +0200
commit002987ab3d49a20d96b8318f8cfa1ca78c2a280e (patch)
treea508bb8face6f792814b0f4083bb71d857a36758
parent11e2c32b4cdd5e3b44d29b86ad3ed1f9d69d66ec (diff)
downloadsamba-002987ab3d49a20d96b8318f8cfa1ca78c2a280e.tar.gz
tests/posixacl: use assertRaises to simplify code
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13521 Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
-rw-r--r--python/samba/tests/posixacl.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/python/samba/tests/posixacl.py b/python/samba/tests/posixacl.py
index b01234d239d..72059bc8f84 100644
--- a/python/samba/tests/posixacl.py
+++ b/python/samba/tests/posixacl.py
@@ -62,11 +62,8 @@ class PosixAclMappingTests(TestCaseInTempDir):
smbd.set_simple_acl(self.tempf, 0o640)
# However, this only asks the xattr
- try:
- facl = getntacl(self.lp, self.tempf, direct_db_access=True)
- self.assertTrue(False)
- except TypeError:
- pass
+ self.assertRaises(
+ TypeError, getntacl, self.lp, self.tempf, direct_db_access=True)
def test_setntacl_invalidate_getntacl(self):
acl = ACL
@@ -184,14 +181,9 @@ class PosixAclMappingTests(TestCaseInTempDir):
self.assertEquals(posix_acl.acl[3].a_perm, 6)
def test_setposixacl_getntacl(self):
- acl = ""
smbd.set_simple_acl(self.tempf, 0o750)
- try:
- facl = getntacl(self.lp, self.tempf)
- self.assertTrue(False)
- except TypeError:
- # We don't expect the xattr to be filled in in this case
- pass
+ # We don't expect the xattr to be filled in in this case
+ self.assertRaises(TypeError, getntacl, self.lp, self.tempf)
def test_setposixacl_getntacl_smbd(self):
s4_passdb = passdb.PDB(self.lp.get("passdb backend"))