def test_remove(self): tmp = self.make_temp_file() self.assertEqual( [], xattr_exe.keys(tmp) ) xattr_exe.set_string(tmp, 'foo', 'hi') self.assertEqual( [ 'foo' ], xattr_exe.keys(tmp) ) xattr_exe.remove(tmp, 'foo') self.assertEqual( [], xattr_exe.keys(tmp) )
def test_keys(self): tmp = self.make_temp_file() self.assertEqual( [], xattr_exe.keys(tmp) ) xattr_exe.set_string(tmp, 'foo', 'hi') self.assertEqual( [ 'foo' ], xattr_exe.keys(tmp) ) xattr_exe.set_string(tmp, 'bar', '666') self.assertEqual( [ 'bar', 'foo' ], xattr_exe.keys(tmp) )
def test_set_string_get_bytes(self): tmp = self.make_temp_file() xattr_exe.set_string(tmp, 'foo', 'hi') self.assertEqual( 'hi'.encode('utf-8'), xattr_exe.get_bytes(tmp, 'foo') )
def test_set_string_get_string(self): tmp = self.make_temp_file() xattr_exe.set_string(tmp, 'foo', 'hi') self.assertEqual( 'hi', xattr_exe.get_string(tmp, 'foo') )
def test_has_key(self): tmp = self.make_temp_file() self.assertFalse( xattr_exe.has_key(tmp, 'foo') ) xattr_exe.set_string(tmp, 'foo', 'hi') self.assertTrue( xattr_exe.has_key(tmp, 'foo') )