def create_bar(): with sudo(user='******'), cd('/srv/'): if exists('/tmp/foo'): mkdir('/tmp/foo/bar') else: print('/tmp/foo does not exist') ls('tamer')
def put_file(): with sudo(user='******'): put('README.md', '/tmp/foobarbaz') ls('/tmp/foobarbaz') run('cat /tmp/foobarbaz') put(StringIO('foobarbazéé'), '/tmp/foobarbaz') run('cat /tmp/foobarbaz')
def test_ls(connection, capsys): assert 'hosts' in ls('/etc/').stdout out, err = capsys.readouterr() assert 'hosts' in out
def test_ls_without_list(patch_client): assert usine.ls('/tmp/foo', list=False) == \ "sh -c $'ls --all --human-readable --size /tmp/foo'"
def test_ls_without_all(patch_client): assert usine.ls('/tmp/foo', all=False) == \ "sh -c $'ls --human-readable --size -l /tmp/foo'"
def test_ls_without_human_readable(patch_client): assert usine.ls('/tmp/foo', human_readable=False) == \ "sh -c $'ls --all --size -l /tmp/foo'"
def test_ls(patch_client): assert usine.ls('/tmp/foo') == \ "sh -c $'ls --all --human-readable --size -l /tmp/foo'"