Spec: add user creation test

This commit is contained in:
Dmitry Maksyoma 2021-09-16 18:33:17 +12:00
parent 04e93956b5
commit a27ad89677
3 changed files with 37 additions and 3 deletions

View File

@ -7,6 +7,7 @@ name = "pypi"
mamba = "*"
expects = "*"
"path.py" = "*"
pexpect = "*"
[dev-packages]

19
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "4f05d36196fe84944e2080a837510bfcfc5616a3e82204a4261bd22bbbc6086d"
"sha256": "a73a3b44f03ce3ee5c5b65a466f97ab3630d8f1666852e996afd6f529a1ba889"
},
"pipfile-spec": 6,
"requires": {
@ -83,7 +83,6 @@
"sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d",
"sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==5.5"
},
"expects": {
@ -105,7 +104,6 @@
"sha256:2de925e8d421f93bcea80d511b81accfb6a7e6b249afa4a5559557b0cf817097",
"sha256:340054c5bb459fc9fd40e7eb6768c5989f3e599d18224238465b5333bc8faa7d"
],
"markers": "python_version >= '3.6'",
"version": "==16.2.0"
},
"path.py": {
@ -115,6 +113,21 @@
],
"index": "pypi",
"version": "==12.5.0"
},
"pexpect": {
"hashes": [
"sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937",
"sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"
],
"index": "pypi",
"version": "==4.8.0"
},
"ptyprocess": {
"hashes": [
"sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35",
"sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"
],
"version": "==0.7.0"
}
},
"develop": {}

View File

@ -1,4 +1,5 @@
import os
import pexpect
import shutil
import subprocess
from path import Path
@ -123,3 +124,22 @@ with description('vncserver') as self:
expect(completed_process.returncode).to(equal(0))
check_de_was_setup_to_run('cinnamon')
with context('guided user creation'):
with fit('asks to create a user if none exist'):
child = pexpect.spawn(f'{vncserver_cmd} -select-de cinnamon',
timeout=2)
child.expect('Enter username')
child.sendline()
child.expect('Password:')
child.sendline('password')
child.expect('Verify:')
child.sendline('password')
child.expect(pexpect.EOF)
child.close()
expect(child.exitstatus).to(equal(0))
home_dir = os.environ['HOME']
user = os.environ['USER']
completed_process = run_cmd(f'grep -q {user} {home_dir}/.kasmpasswd')
expect(completed_process.returncode).to(equal(0))