mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-02-14 17:39:12 +01:00
Spec refactoring
This commit is contained in:
parent
d522457723
commit
d1f0d6f7e7
@ -3,22 +3,29 @@ import subprocess
|
|||||||
from mamba import description, context, it
|
from mamba import description, context, it
|
||||||
from expects import expect, equal
|
from expects import expect, equal
|
||||||
|
|
||||||
with description('vncserver') as self:
|
|
||||||
with it('selects passed DE with -s'):
|
|
||||||
subprocess.run('echo -e "password\\npassword\\n" | vncpasswd -u docker',
|
|
||||||
shell=True, text=True, executable='/bin/bash')
|
|
||||||
|
|
||||||
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'
|
def run_cmd(cmd):
|
||||||
try:
|
completed_process = subprocess.run(cmd, shell=True, text=True,
|
||||||
completed_process = subprocess.run(cmd, shell=True, capture_output=True,
|
capture_output=True,
|
||||||
text=True, timeout=3)
|
executable='/bin/bash')
|
||||||
if completed_process.returncode != 0:
|
if completed_process.returncode != 0:
|
||||||
print(completed_process.stdout)
|
print(completed_process.stdout)
|
||||||
print(completed_process.stderr)
|
print(completed_process.stderr)
|
||||||
expect(completed_process.returncode).to(equal(0))
|
|
||||||
|
return completed_process
|
||||||
|
|
||||||
|
|
||||||
|
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))
|
expect(completed_process.returncode).to(equal(0))
|
||||||
|
|
||||||
exitcode = os.system('grep -q mate ~/.vnc/xstartup')
|
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'
|
||||||
expect(exitcode).to(equal(0))
|
try:
|
||||||
|
completed_process = run_cmd(cmd)
|
||||||
|
expect(completed_process.returncode).to(equal(0))
|
||||||
|
|
||||||
|
completed_process = run_cmd('grep -q mate ~/.vnc/xstartup')
|
||||||
|
expect(completed_process.returncode).to(equal(0))
|
||||||
finally:
|
finally:
|
||||||
subprocess.run('vncserver -kill :1', capture_output=True, shell=True, timeout=3)
|
run_cmd('vncserver -kill :1')
|
||||||
|
Loading…
Reference in New Issue
Block a user