1
0
forked from Georg/pyacl

Test in container

Avoid the need for specific test users on ones main system.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2024-09-16 16:41:55 +02:00
parent 48b54bbd71
commit 6f05367ae6
Signed by untrusted user: Georg
GPG Key ID: 1ED2F138E7E6FF57
3 changed files with 14 additions and 5 deletions

13
test.sh
View File

@ -1,2 +1,11 @@
#!/bin/sh -x #!/bin/sh -ex
PYTHONPATH=. pytest --pdb --pdbcls=IPython.terminal.debugger:Pdb -rA -s -v -x
command -v podman
wd='/work'
podman run \
-it \
--pull=always \
--rm \
-v .:/"$wd" \
registry.opensuse.org/home/crameleon/containers/containers/crameleon/pytest-acl:latest \
env PYTHONPATH=/"$wd" pytest --pdb --pdbcls=IPython.terminal.debugger:Pdb -rA -s -v -x "$wd"/tests

View File

@ -20,8 +20,8 @@ def sample_file(tmp_path_factory):
file = directory / 'file_with_user_read_acl' file = directory / 'file_with_user_read_acl'
file.touch() file.touch()
assert not file.read_text() # file should exist assert not file.read_text() # file should exist
run(['setfacl', '-m', 'u:georg2:r', file], check=True) run(['setfacl', '-m', 'u:user:r', file], check=True)
out = run(['getfacl', '-c', file], check=True, capture_output=True) out = run(['getfacl', '-c', file], check=True, capture_output=True)
assert 'user:georg2:r--' in out.stdout.decode() # file should have the ACL set assert 'user:user:r--' in out.stdout.decode() # file should have the ACL set
yield file yield file
rmtree(directory) rmtree(directory)

View File

@ -14,7 +14,7 @@ from pyacl import acl
def test_parse_acl(sample_file): def test_parse_acl(sample_file):
want = { want = {
'user': { 'user': {
'georg2': { 'user': {
'read': True, 'read': True,
'write': False, 'write': False,
'execute': False, 'execute': False,