From a191f30f16126f3f058fd7ea5f36215b280639ec Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Mon, 25 Nov 2019 04:35:32 +0100 Subject: [PATCH] Add explicit test for symlink creation failure --- test/test_xattr.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_xattr.py b/test/test_xattr.py index 26d15d1..32f84a3 100644 --- a/test/test_xattr.py +++ b/test/test_xattr.py @@ -343,6 +343,16 @@ def test_binary_payload(subject): assert xattr.get_all(item, namespace=NAMESPACE) == [(USER_NN, BINVAL)] xattr.remove(item, USER_ATTR) +def test_symlinks_user_fail(testdir, use_dangling): + _, sname = get_symlink(testdir, dangling=use_dangling) + with pytest.raises(IOError): + xattr.set(sname, USER_ATTR, USER_VAL, nofollow=True) + with pytest.raises(IOError): + xattr.set(sname, USER_NN, USER_VAL, namespace=NAMESPACE, + nofollow=True) + with pytest.raises(IOError): + xattr.setxattr(sname, USER_ATTR, USER_VAL, XATTR_CREATE, True) + def test_none_namespace(subject): with pytest.raises(TypeError): xattr.get(subject[0], USER_ATTR, namespace=None) -- 2.39.2