From 30d5799a7061e3a55ed8cb7a9eed97e9c124e1fd Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Wed, 4 Dec 2019 00:50:57 +0100 Subject: [PATCH] Fix from_acl tests for non-Linux platforms FreeBSD doesn't have acl_cmp, so comparison via rich compare is not defined, thus all comparisons are False. Fix tests so the equality check is only done on Linux, and add a poor man's test via string representation equality. --- tests/test_acls.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_acls.py b/tests/test_acls.py index 8ba98de..2063226 100644 --- a/tests/test_acls.py +++ b/tests/test_acls.py @@ -271,12 +271,20 @@ class TestLoad: acl1 = posix1e.ACL(text=BASIC_ACL_TEXT) assert acl1.valid() + # This is acl_check, but should actually be have_linux... + @require_acl_check def test_from_acl(self): """Test creating an ACL from an existing ACL""" - acl1 = posix1e.ACL() + acl1 = posix1e.ACL(text=BASIC_ACL_TEXT) acl2 = posix1e.ACL(acl=acl1) assert acl1 == acl2 + def test_from_acl_via_str(self): + # This is needed for not HAVE_LINUX cases. + acl1 = posix1e.ACL(text=BASIC_ACL_TEXT) + acl2 = posix1e.ACL(acl=acl1) + assert str(acl1) == str(acl2) + def test_invalid_creation_params(self, testdir): """Test that creating an ACL from multiple objects fails""" fd, _ = get_file(testdir) -- 2.39.5