Ejemplo n.º 1
0
 def test_restore_metadata_none(self):
     # No initial metadata
     path = "/tmp/foo/i"
     res_d = utils.restore_metadata(path, { 'b': 'y' })
     expected_d = { 'b': 'y' }
     assert res_d == expected_d, "Expected %r, result %r" % (expected_d, res_d)
     assert _xattr_op_cnt['get'] == 1, "%r" % _xattr_op_cnt
     assert _xattr_op_cnt['set'] == 1, "%r" % _xattr_op_cnt
Ejemplo n.º 2
0
 def test_restore_metadata_nochange(self):
     # Initial metadata but no changes
     path = "/tmp/foo/i"
     initial_d = { 'a': 'z' }
     xkey = _xkey(path, utils.METADATA_KEY)
     _xattrs[xkey] = pickle.dumps(initial_d, utils.PICKLE_PROTOCOL)
     res_d = utils.restore_metadata(path, {})
     expected_d = { 'a': 'z' }
     assert res_d == expected_d, "Expected %r, result %r" % (expected_d, res_d)
     assert _xattr_op_cnt['get'] == 1, "%r" % _xattr_op_cnt
     assert _xattr_op_cnt['set'] == 0, "%r" % _xattr_op_cnt