Fix user name test to run on computers that isn't mine

pull/172/head
yuvipanda 2017-12-19 16:36:37 -08:00
rodzic e4410b9caf
commit 8e1109e863
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -11,12 +11,14 @@ 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' # FIXME: Use arbitrary login here, We need it now since we wanna put things to volume.
username = os.getlogin()
userid = str(os.geteuid())
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory() as tmpdir:
subprocess.check_call([ subprocess.check_call([
'repo2docker', 'repo2docker',
'-v', '{}:/home/{}'.format(tmpdir, username), '-v', '{}:/home/{}'.format(tmpdir, username),
'--user-id', '1000', '--user-id', userid,
'--user-name', username, '--user-name', username,
tmpdir, tmpdir,
'--', '--',
@ -25,7 +27,7 @@ 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() == userid
with open(os.path.join(tmpdir, 'pwd')) as f: with open(os.path.join(tmpdir, 'pwd')) as f:
assert f.read().strip() == '/home/{}'.format(username) 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: