예제 #1
0
파일: tmetadata.py 프로젝트: Kelimion/bup
 def test_handling_of_incorrect_existing_linux_xattrs():
     if not is_superuser() or detect_fakeroot():
         WVMSG('skipping test -- not superuser')
         return
     setup_testfs()
     for f in glob.glob('testfs/*'):
         ex('rm', '-rf', f)
     path = 'testfs/foo'
     open(path, 'w').close()
     xattr.set(path, 'foo', 'bar', namespace=xattr.NS_USER)
     m = metadata.from_path(path, archive_path=path, save_symlinks=True)
     xattr.set(path, 'baz', 'bax', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ['user.foo'])
     WVPASSEQ(xattr.get(path, 'user.foo'), 'bar')
     xattr.set(path, 'foo', 'baz', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ['user.foo'])
     WVPASSEQ(xattr.get(path, 'user.foo'), 'bar')
     xattr.remove(path, 'foo', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ['user.foo'])
     WVPASSEQ(xattr.get(path, 'user.foo'), 'bar')
     os.chdir(start_dir)
     cleanup_testfs()
예제 #2
0
 def test_handling_of_incorrect_existing_linux_xattrs():
     if not is_superuser() or detect_fakeroot():
         pytest.skip('skipping test -- not superuser')
         return
     if not setup_testfs():
         pytest.skip('unable to load loop module; skipping dependent tests')
         return
     for f in glob.glob(b'testfs/*'):
         ex(b'rm', b'-rf', f)
     path = b'testfs/foo'
     open(path, 'w').close()
     xattr.set(path, b'foo', b'bar', namespace=xattr.NS_USER)
     m = metadata.from_path(path, archive_path=path, save_symlinks=True)
     xattr.set(path, b'baz', b'bax', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
     WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
     xattr.set(path, b'foo', b'baz', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
     WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
     xattr.remove(path, b'foo', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(remove_selinux(xattr.list(path)), [b'user.foo'])
     WVPASSEQ(xattr.get(path, b'user.foo'), b'bar')
     cleanup_testfs()
예제 #3
0
 def test_handling_of_incorrect_existing_linux_xattrs():
     if not is_superuser() or detect_fakeroot():
         WVMSG('skipping test -- not superuser')
         return
     setup_testfs()
     for f in glob.glob('testfs/*'):
         ex('rm', '-rf', f)
     path = 'testfs/foo'
     open(path, 'w').close()
     xattr.set(path, 'foo', 'bar', namespace=xattr.NS_USER)
     m = metadata.from_path(path, archive_path=path, save_symlinks=True)
     xattr.set(path, 'baz', 'bax', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ['user.foo'])
     WVPASSEQ(xattr.get(path, 'user.foo'), 'bar')
     xattr.set(path, 'foo', 'baz', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ['user.foo'])
     WVPASSEQ(xattr.get(path, 'user.foo'), 'bar')
     xattr.remove(path, 'foo', namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ['user.foo'])
     WVPASSEQ(xattr.get(path, 'user.foo'), 'bar')
     os.chdir(start_dir)
     cleanup_testfs()
예제 #4
0
 def test_handling_of_incorrect_existing_linux_xattrs():
     if not is_superuser() or detect_fakeroot():
         WVMSG("skipping test -- not superuser")
         return
     setup_testfs()
     for f in glob.glob("testfs/*"):
         ex("rm", "-rf", f)
     path = "testfs/foo"
     open(path, "w").close()
     xattr.set(path, "foo", "bar", namespace=xattr.NS_USER)
     m = metadata.from_path(path, archive_path=path, save_symlinks=True)
     xattr.set(path, "baz", "bax", namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ["user.foo"])
     WVPASSEQ(xattr.get(path, "user.foo"), "bar")
     xattr.set(path, "foo", "baz", namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ["user.foo"])
     WVPASSEQ(xattr.get(path, "user.foo"), "bar")
     xattr.remove(path, "foo", namespace=xattr.NS_USER)
     m.apply_to_path(path, restore_numeric_ids=False)
     WVPASSEQ(xattr.list(path), ["user.foo"])
     WVPASSEQ(xattr.get(path, "user.foo"), "bar")
     os.chdir(start_dir)
     cleanup_testfs()