def test_install(self): task = Task() task.assert_that(Package('python3-virtualenv'), installed()) task.assert_that(Package('virtualenv'), installed()) task.command('rm dist/*', expected=None) task.command('python setup.py sdist', timeout=20) task.command('virtualenv --clear venv', timeout=10) task.command( '. venv/bin/activate; pip install dist/prego*; echo y | pip uninstall prego; deactivate', timeout=50)
def test_netcat(self): ctx.port = 2000 server = Task(desc='netcat server', detach=True) server.assert_that(Package('nmap'), installed()) server.assert_that(localhost, hamcrest.is_not(listen_port(ctx.port))) cmd = server.command('ncat -l -p $port') server.assert_that(cmd.stdout.content, hamcrest.contains_string('bye')) client = Task(desc='netcat client') client.wait_that(server, running()) client.wait_that(localhost, listen_port(ctx.port)) client.command('ncat -c "echo bye" localhost $port')
def test_installed_version(self): depends = Task() depends.assert_that(Package('bash'), installed(min_version='3.0'))
def test_installed(self): depends = Task() depends.assert_that(Package('bash'), installed()) depends.assert_that(Package('never-installed'), is_not(installed()))
def test(self): Task().assert_that(Package('python3-twisted'), installed())