Skip to content

Commit

Permalink
Linux: acl tests: move ACCESS_ACL and DEFAULT_ACL constants
Browse files Browse the repository at this point in the history
They are only used at one place, move them there rather than having globals.
  • Loading branch information
ThomasWaldmann committed Mar 17, 2024
1 parent b45f572 commit 54c7da3
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/borg/testsuite/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@
from .locking import free_pid


ACCESS_ACL = """
user::rw-
user:root:rw-:0
user:9999:r--:9999
group::r--
group:root:r--:0
group:9999:r--:9999
mask::rw-
other::r--
""".strip().encode('ascii')

DEFAULT_ACL = """
user::rw-
user:root:r--:0
user:8888:r--:8888
group::r--
group:root:r--:0
group:8888:r--:8888
mask::rw-
other::r--
""".strip().encode('ascii')


def fakeroot_detected():
return 'FAKEROOTKEY' in os.environ

Expand Down Expand Up @@ -125,6 +102,8 @@ def test_access_acl(self):

@unittest.skipIf(not are_acls_working(), 'ACLs do not work')
def test_default_acl(self):
ACCESS_ACL = b'user::rw-\nuser:root:rw-:0\nuser:9999:r--:9999\ngroup::r--\ngroup:root:r--:0\ngroup:9999:r--:9999\nmask::rw-\nother::r--'
DEFAULT_ACL = b'user::rw-\nuser:root:r--:0\nuser:8888:r--:8888\ngroup::r--\ngroup:root:r--:0\ngroup:8888:r--:8888\nmask::rw-\nother::r--'
self.assert_equal(self.get_acl(self.tmpdir), {})
self.set_acl(self.tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
self.assert_equal(self.get_acl(self.tmpdir)['acl_access'], ACCESS_ACL)
Expand Down

0 comments on commit 54c7da3

Please sign in to comment.