#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function

import sys
import os

sys.path.insert(0, os.path.abspath('..'))

from clint import resources

resources.init('kennethreitz', 'clint')

lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'


print('%s created.' % resources.user.path)

resources.user.write('lorem.txt', lorem)
print('lorem.txt created')

assert resources.user.read('lorem.txt') == lorem
print('lorem.txt has correct contents')

resources.user.delete('lorem.txt')
print('lorem.txt deleted')

assert resources.user.read('lorem.txt') == None
print('lorem.txt deletion confirmed')

[((13, 0, 13, 39), 'clint.resources.init', 'resources.init', ({(13, 15, 13, 29): '"""kennethreitz"""', (13, 31, 13, 38): '"""clint"""'}, {}), "('kennethreitz', 'clint')", False, 'from clint import resources\n'), ((20, 0, 20, 40), 'clint.resources.user.write', 'resources.user.write', ({(20, 21, 20, 32): '"""lorem.txt"""', (20, 34, 20, 39): 'lorem'}, {}), "('lorem.txt', lorem)", False, 'from clint import resources\n'), ((26, 0, 26, 34), 'clint.resources.user.delete', 'resources.user.delete', ({(26, 22, 26, 33): '"""lorem.txt"""'}, {}), "('lorem.txt')", False, 'from clint import resources\n'), ((9, 19, 9, 40), 'os.path.abspath', 'os.path.abspath', ({(9, 35, 9, 39): '""".."""'}, {}), "('..')", False, 'import os\n'), ((23, 7, 23, 39), 'clint.resources.user.read', 'resources.user.read', ({(23, 27, 23, 38): '"""lorem.txt"""'}, {}), "('lorem.txt')", False, 'from clint import resources\n'), ((29, 7, 29, 39), 'clint.resources.user.read', 'resources.user.read', ({(29, 27, 29, 38): '"""lorem.txt"""'}, {}), "('lorem.txt')", False, 'from clint import resources\n')]