writeAuthorizedKeys now reads old file by name, not by open file.

This commit is contained in:
Tommi Virtanen 2007-06-04 14:22:45 +03:00
parent 8d69bf23fa
commit 085e5fffa7

View file

@ -171,7 +171,9 @@ class WriteAuthorizedKeys_Test(object):
def test_simple(self): def test_simple(self):
tmp = maketemp() tmp = maketemp()
path = os.path.join(tmp, 'authorized_keys') path = os.path.join(tmp, 'authorized_keys')
oldfp = StringIO('''\ f = file(path, 'w')
try:
f.write('''\
# foo # foo
bar bar
### autogenerated by gitosis, DO NOT EDIT ### autogenerated by gitosis, DO NOT EDIT
@ -179,12 +181,14 @@ command="/foo/bar/baz/gitosis-serve wsmith",no-port-forwarding,\
no-X11-forwarding,no-agent-forwarding,no-pty %(key_2)s no-X11-forwarding,no-agent-forwarding,no-pty %(key_2)s
baz baz
''' % dict(key_2=KEY_2)) ''' % dict(key_2=KEY_2))
finally:
f.close()
keydir = os.path.join(tmp, 'one') keydir = os.path.join(tmp, 'one')
mkdir(keydir) mkdir(keydir)
writeFile(os.path.join(keydir, 'jdoe.pub'), KEY_1+'\n') writeFile(os.path.join(keydir, 'jdoe.pub'), KEY_1+'\n')
ssh.writeAuthorizedKeys( ssh.writeAuthorizedKeys(
oldfp=oldfp, newpath=path, keydir=keydir) path=path, keydir=keydir)
f = file(path) f = file(path)
try: try: