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:
parent
48b54bbd71
commit
6f05367ae6
13
test.sh
13
test.sh
@ -1,2 +1,11 @@
|
||||
#!/bin/sh -x
|
||||
PYTHONPATH=. pytest --pdb --pdbcls=IPython.terminal.debugger:Pdb -rA -s -v -x
|
||||
#!/bin/sh -ex
|
||||
|
||||
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
|
||||
|
@ -20,8 +20,8 @@ def sample_file(tmp_path_factory):
|
||||
file = directory / 'file_with_user_read_acl'
|
||||
file.touch()
|
||||
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)
|
||||
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
|
||||
rmtree(directory)
|
||||
|
@ -14,7 +14,7 @@ from pyacl import acl
|
||||
def test_parse_acl(sample_file):
|
||||
want = {
|
||||
'user': {
|
||||
'georg2': {
|
||||
'user': {
|
||||
'read': True,
|
||||
'write': False,
|
||||
'execute': False,
|
||||
|
Loading…
Reference in New Issue
Block a user