# Path: nuka/tasks/file.py
# class exists(Task):
# class mkdir(Task):
# class mkdirs(Task):
# class rm(Task):
# class mv(Task):
# class chmod(Task):
# class chown(Task):
# class put(Task):
# class scripts(put):
# class cat(Task):
# class update(Task):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod=None, own=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, directories=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, src=None, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod='644', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, own='root:root', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, files=None, **kwargs):
#     def pre_process(self):
#     def do(self):
#     def diff(self):
#     def do(self):
#     def __init__(self, src=None, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, replaces=None, appends=None, **kwargs):
#     def pre_process(self):
#     def update(self, data):
#     def do(self):
#     def diff(self, dst=None, **kwargs):


import jinja2
import pytest
import asyncio
from nuka.tasks import file
        fd.write(b'yo')
    res = await file.put([dict(
        src='/tmp/to_put.txt', dst='/tmp/test_' + user,
        )],
        switch_user=user)
    assert bool(res)
    res = await file.rm(dst='/tmp/test_' + user,
                        switch_user=user)
    assert bool(res)

    with pytest.raises(asyncio.CancelledError):
        await file.put([dict(src='/tmp/to_put.txt', dst='/etc/test_' + user)],
                       switch_user=user)


@pytest.mark.asyncio
async def test_scripts(host):
    hid = str(id(host))
    script = '#!/bin/bash\necho {0} > /tmp/h'.format(hid)
    with open('/tmp/to_put_script', 'wb') as fd:
        fd.write(script.encode('utf8'))
    res = await file.scripts([dict(
        src='/tmp/to_put_script', dst='/tmp/script'
    )])
    assert bool(res)

    res = await file.cat('/tmp/h')
    assert res.content.strip() == hid



# Path: nuka/tasks/file.py
# class exists(Task):
# class mkdir(Task):
# class mkdirs(Task):
# class rm(Task):
# class mv(Task):
# class chmod(Task):
# class chown(Task):
# class put(Task):
# class scripts(put):
# class cat(Task):
# class update(Task):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod=None, own=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, directories=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, src=None, dst=None, **kwargs):
#     def do(self):
#     def diff(self):
#     def __init__(self, dst=None, mod='644', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, own='root:root', recursive=False, **kwargs):
#     def do(self):
#     def __init__(self, files=None, **kwargs):
#     def pre_process(self):
#     def do(self):
#     def diff(self):
#     def do(self):
#     def __init__(self, src=None, **kwargs):
#     def do(self):
#     def __init__(self, dst=None, replaces=None, appends=None, **kwargs):
#     def pre_process(self):
#     def update(self, data):
#     def do(self):
#     def diff(self, dst=None, **kwargs):


# Path: tests/tasks/test_file.py
import jinja2
import pytest
import asyncio
from nuka.tasks import file

        fd.write(b'yo')
    res = await file.put([dict(
        src='/tmp/to_put.txt', dst='/tmp/test_' + user,
        )],
        switch_user=user)
    assert bool(res)
    res = await file.rm(dst='/tmp/test_' + user,
                        switch_user=user)
    assert bool(res)

    with pytest.raises(asyncio.CancelledError):
        await file.put([dict(src='/tmp/to_put.txt', dst='/etc/test_' + user)],
                       switch_user=user)


@pytest.mark.asyncio
async def test_scripts(host):
    hid = str(id(host))
    script = '#!/bin/bash\necho {0} > /tmp/h'.format(hid)
    with open('/tmp/to_put_script', 'wb') as fd:
        fd.write(script.encode('utf8'))
    res = await file.scripts([dict(
        src='/tmp/to_put_script', dst='/tmp/script'
    )])
    assert bool(res)

    res = await file.cat('/tmp/h')
    assert res.content.strip() == hid



@pytest.mark.asyncio