Refactor tests

This commit is contained in:
VirtuBox
2019-10-29 13:58:17 +01:00
parent 8b32910c07
commit 4c1569781d

View File

@@ -5,67 +5,18 @@ from wo.cli.main import get_test_app
class CliTestCaseStack(test.WOTestCase): class CliTestCaseStack(test.WOTestCase):
def test_wo_cli(self): def test_wo_cli(self):
self.app.setup() argv = []
self.app.run()
self.app.close()
def test_wo_cli_stack_install(self):
argv = ['stack', 'install']
with self.make_app(argv=argv) as app: with self.make_app(argv=argv) as app:
app.run() app.run()
self.eq(app.pargs.stack.install) self.eq(app.pargs.stack)
def test_wo_cli_stacks_install(self):
def test_wo_cli_stack_install_web(self): wo_stacks = ['nginx', 'php', 'php73', 'mysql', 'redis', 'fail2ban',
self.app = get_test_app(argv=['stack', 'install', '--web']) 'clamav', 'proftpd', 'netdata',
self.app.setup() 'phpmyadmin', 'composer', 'dashboard', 'extplorer',
self.app.run() 'adminer', 'redis', 'ufw', 'ngxblocker', 'cheat']
self.app.close() for wo_stack in wo_stacks:
argv = ['stack', 'install', '--{0}'.format(wo_stack)]
def test_wo_cli_stack_install_admin(self): with self.make_app(argv=argv) as app:
self.app = get_test_app(argv=['stack', 'install', '--admin']) app.run()
self.app.setup() self.eq(app.pargs.stack.install.wo_stack)
self.app.run()
self.app.close()
def test_wo_cli_stack_install_nginx(self):
self.app = get_test_app(argv=['stack', 'install', '--nginx'])
self.app.setup()
self.app.run()
self.app.close()
def test_wo_cli_stack_install_php(self):
self.app = get_test_app(argv=['stack', 'install', '--php'])
self.app.setup()
self.app.run()
self.app.close()
def test_wo_cli_stack_install_mysql(self):
self.app = get_test_app(argv=['stack', 'install', '--mysql'])
self.app.setup()
self.app.run()
self.app.close()
def test_wo_cli_stack_install_wpcli(self):
self.app = get_test_app(argv=['stack', 'install', '--wpcli'])
self.app.setup()
self.app.run()
self.app.close()
def test_wo_cli_stack_install_phpmyadmin(self):
self.app = get_test_app(argv=['stack', 'install', '--phpmyadmin'])
self.app.setup()
self.app.run()
self.app.close()
def test_wo_cli_stack_install_adminer(self):
self.app = get_test_app(argv=['stack', 'install', '--adminer'])
self.app.setup()
self.app.run()
self.app.close()
def test_wo_cli_stack_install_utils(self):
self.app = get_test_app(argv=['stack', 'install', '--utils'])
self.app.setup()
self.app.run()
self.app.close()