Fix python codestyle

This commit is contained in:
Ayaz Salikhov
2020-06-25 19:44:20 +02:00
parent 229c7fea9d
commit 94cd03d6b9
11 changed files with 37 additions and 43 deletions

View File

@@ -70,23 +70,25 @@ def test_nb_user_change(container):
running_container = container.run(
tty=True,
user="root",
environment=[f"NB_USER={nb_user}",
"CHOWN_HOME=yes"],
environment=[
f"NB_USER={nb_user}",
"CHOWN_HOME=yes"
],
working_dir=f"/home/{nb_user}",
command=['start.sh', 'bash', '-c', 'sleep infinity']
)
LOGGER.info(f"Checking if the user is changed to {nb_user} by the start script ...")
output = running_container.logs(stdout=True).decode("utf-8")
assert f"Set username to: {nb_user}" in output, f"User is not changed to {nb_user}"
assert f"Set username to: {nb_user}" in output, f"User is not changed to {nb_user}"
LOGGER.info(f"Checking {nb_user} id ...")
command = "id"
expected_output = f"uid=1000({nb_user}) gid=100(users) groups=100(users)"
cmd = running_container.exec_run(command, user=nb_user)
output = cmd.output.decode("utf-8").strip("\n")
assert output == expected_output, f"Bad user {output}, expected {expected_output}"
LOGGER.info(f"Checking if {nb_user} owns his home folder ...")
command = f'stat -c "%U %G" /home/{nb_user}/'
expected_output = f"{nb_user} users"
@@ -100,10 +102,11 @@ def test_chown_extra(container):
c = container.run(
tty=True,
user='root',
environment=['NB_UID=1010',
'NB_GID=101',
'CHOWN_EXTRA=/opt/conda',
'CHOWN_EXTRA_OPTS=-R',
environment=[
'NB_UID=1010',
'NB_GID=101',
'CHOWN_EXTRA=/opt/conda',
'CHOWN_EXTRA_OPTS=-R'
],
command=['start.sh', 'bash', '-c', 'stat -c \'%n:%u:%g\' /opt/conda/LICENSE.txt']
)
@@ -113,13 +116,14 @@ def test_chown_extra(container):
def test_chown_home(container):
"""Container should change the NB_USER home directory owner and
"""Container should change the NB_USER home directory owner and
group to the current value of NB_UID and NB_GID."""
c = container.run(
tty=True,
user='root',
environment=['CHOWN_HOME=yes',
'CHOWN_HOME_OPTS=-R',
environment=[
'CHOWN_HOME=yes',
'CHOWN_HOME_OPTS=-R'
],
command=['start.sh', 'bash', '-c', 'chown root:root /home/jovyan && ls -alsh /home']
)