support/testing: test_acl.py: use assertRunNotOk()

Use the helper to simplify the test.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Peter Korsgaard
2026-06-18 14:47:54 +02:00
parent 8c301eed0e
commit 8caecb62a3

View File

@@ -52,8 +52,7 @@ class TestAcl(infra.basetest.BRTest):
# Reading the file as the test user is expected to fail.
test_read_cmd = f"su - {test_user} -c 'cat {test_file}'"
_, ret = self.emulator.run(test_read_cmd)
self.assertNotEqual(ret, 0)
self.assertRunNotOk(test_read_cmd)
# We add a special read ACL for the test user.
cmd = f"setfacl -m u:{test_user}:r {test_file}"
@@ -73,8 +72,7 @@ class TestAcl(infra.basetest.BRTest):
# Attempting to write to the file as the test user is expected
# to fail (since we put an ACL only for reading).
cmd = f"su - {test_user} -c 'echo WriteTest > {test_file}'"
_, ret = self.emulator.run(cmd)
self.assertNotEqual(ret, 0)
self.assertRunNotOk(cmd)
# Remove all ACLs. This could have been done with the command
# "setfacl -b". Instead, we use the "chacl -B" command which
@@ -83,5 +81,4 @@ class TestAcl(infra.basetest.BRTest):
self.assertRunOk(f"chacl -B {test_file}")
# Reading the file as the test user is expected to fail again.
_, ret = self.emulator.run(test_read_cmd)
self.assertNotEqual(ret, 0)
self.assertRunNotOk(test_read_cmd)