def test_read(self):
        # Clear existing attributes
        self.assertTrue(self.run_function('xattr.clear', [TEST_FILE]))

        # Write an attribute
        self.assertTrue(
            self.run_function('xattr.write',
                              [TEST_FILE, 'spongebob', 'squarepants']))

        # Read the attribute
        self.assertEqual(
            self.run_function('xattr.read', [TEST_FILE, 'spongebob']),
            'squarepants')

        # Test file not found
        self.assertEqual(
            self.run_function('xattr.read', [NO_FILE, 'spongebob']),
            'ERROR: File not found: {0}'.format(NO_FILE))

        # Test attribute not found
        self.assertEqual(
            self.run_function('xattr.read', [TEST_FILE, 'patrick']),
            'ERROR: Attribute not found: patrick')
Test xattr.read
dataset/ETHPy150Open saltstack/salt/tests/integration/modules/mac_xattr.py/MacXattrModuleTest.test_read