def test_put_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): local('echo "toto" > /tmp/toto') put('/tmp/toto', '/tmp/toto') assert run('test -f /tmp/toto').succeeded
def test_sudo_nobody_file_ownership_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): with cd('/tmp'): sudo('touch tata', user='******') assert run('stat -c "%U" tata') == 'nobody'
def test_install_redis_in_guest_context_manager(container): from burlap.openvz import guest from burlap.require.redis import VERSION, instance with guest(container): instance('test') assert is_file('/etc/redis/test.conf') assert run('echo PING | /opt/redis-%s/redis-cli' % VERSION) == 'PONG'
def test_require_directory_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): require_directory('/tmp/newdir') with cd('/tmp/newdir'): run('touch baz') assert is_file('/tmp/newdir/baz')
def test_cd_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): with cd('/tmp'): run('touch bar') assert is_file('bar') assert is_file('/tmp/bar')
def test_install_debian_package_in_guest_context_manager(container): from burlap.deb import update_index from burlap.openvz import guest from burlap.require.deb import package as require_deb_package with guest(container): update_index() require_deb_package('htop') assert is_file('/usr/bin/htop')
def test_require_file_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): require_file('/tmp/foo') assert is_file('/tmp/foo')
def test_sudo_nobody_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): assert sudo('whoami', user='******') == 'nobody'
def test_sudo_root_in_guest_context_manager(container): from burlap.openvz import guest with guest(container): assert sudo('whoami') == 'root'