From dca392eafdac5999a5acec01a2bd37332d6c7110 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 14 Sep 2021 20:19:06 +1200 Subject: [PATCH] Specs: extract add_kasmvnc_user_docker() --- spec/vncserver_spec.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spec/vncserver_spec.py b/spec/vncserver_spec.py index 2c68f00..b08619a 100644 --- a/spec/vncserver_spec.py +++ b/spec/vncserver_spec.py @@ -15,10 +15,14 @@ def run_cmd(cmd, **kwargs): return completed_process +def add_kasmvnc_user_docker(): + completed_process = run_cmd('echo -e "password\\npassword\\n" | vncpasswd -u docker') + expect(completed_process.returncode).to(equal(0)) + + with description('vncserver') as self: with it('selects passed DE with -s'): - completed_process = run_cmd('echo -e "password\\npassword\\n" | vncpasswd -u docker') - expect(completed_process.returncode).to(equal(0)) + add_kasmvnc_user_docker() cmd = 'vncserver :1 -select-de mate -cert /etc/ssl/certs/ssl-cert-snakeoil.pem -key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www -depth 24 -geometry 1280x1050' try: @@ -31,8 +35,7 @@ with description('vncserver') as self: run_cmd('vncserver -kill :1') with it('asks to select a DE, when ran with -select-de'): - completed_process = run_cmd('echo -e "password\\npassword\\n" | vncpasswd -u docker') - expect(completed_process.returncode).to(equal(0)) + add_kasmvnc_user_docker() cmd = 'vncserver :1 -select-de -cert /etc/ssl/certs/ssl-cert-snakeoil.pem -key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 -interface 0.0.0.0 -httpd /usr/share/kasmvnc/www -depth 24 -geometry 1280x1050' try: