From d8bbb9884dad4fb7533e4390a08d3c5c8fee1061 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Fri, 10 Sep 2021 23:35:47 +1200 Subject: [PATCH] vncserver: spec creates password file --- spec/vncserver_spec.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/spec/vncserver_spec.py b/spec/vncserver_spec.py index bc6eb9d..490ac67 100644 --- a/spec/vncserver_spec.py +++ b/spec/vncserver_spec.py @@ -4,18 +4,21 @@ from mamba import description, context, it from expects import expect, equal with description('vncserver') as self: - with it('selects passed DE with -s'): - 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: - completed_process = subprocess.run(cmd, shell=True, capture_output=True, - text=True, timeout=3) - if completed_process.returncode != 0: - print(completed_process.stdout) - print(completed_process.stderr) - expect(completed_process.returncode).to(equal(0)) - expect(completed_process.returncode).to(equal(0)) + with it('selects passed DE with -s'): + subprocess.run('echo -e "password\\npassword\\n" | vncpasswd -u docker', + shell=True, text=True, executable='/bin/bash') - exitcode = os.system('grep -q mate ~/.vnc/xstartup') - expect(exitcode).to(equal(0)) - finally: - subprocess.run('vncserver -kill :1', capture_output=True, shell=True, timeout=3) + 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: + completed_process = subprocess.run(cmd, shell=True, capture_output=True, + text=True, timeout=3) + if completed_process.returncode != 0: + print(completed_process.stdout) + print(completed_process.stderr) + expect(completed_process.returncode).to(equal(0)) + expect(completed_process.returncode).to(equal(0)) + + exitcode = os.system('grep -q mate ~/.vnc/xstartup') + expect(exitcode).to(equal(0)) + finally: + subprocess.run('vncserver -kill :1', capture_output=True, shell=True, timeout=3)