Fix username check

pull/172/head
yuvipanda 2017-12-19 13:27:22 -08:00
rodzic 25177f0343
commit 7815e15c1f
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -11,13 +11,13 @@ def test_user():
Validate user id and name setting Validate user id and name setting
""" """
ts = str(time.time()) ts = str(time.time())
username = 'yuvipanda'
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory() as tmpdir:
username = os.getlogin()
subprocess.check_call([ subprocess.check_call([
'repo2docker', 'repo2docker',
'-v', '{}:/home/{}'.format(tmpdir, username), '-v', '{}:/home/{}'.format(tmpdir, username),
'--user-id', '1000', '--user-id', '1000',
'--user-name', 'yuvipanda', '--user-name', username,
tmpdir, tmpdir,
'--', '--',
'/bin/bash', '/bin/bash',
@ -27,8 +27,8 @@ def test_user():
with open(os.path.join(tmpdir, 'id')) as f: with open(os.path.join(tmpdir, 'id')) as f:
assert f.read().strip() == '1000' assert f.read().strip() == '1000'
with open(os.path.join(tmpdir, 'pwd')) as f: with open(os.path.join(tmpdir, 'pwd')) as f:
assert f.read().strip() == '/home/yuvipanda' assert f.read().strip() == '/home/{}'.format(username)
with open(os.path.join(tmpdir, 'name')) as f: with open(os.path.join(tmpdir, 'name')) as f:
assert f.read().strip() == 'yuvipanda' assert f.read().strip() == username
with open(os.path.join(tmpdir, 'env_user')) as f: with open(os.path.join(tmpdir, 'name')) as f:
assert f.read().strip() == 'yuvipanda' assert f.read().strip() == username