[niedbalski] fixup unit tests for key management

This commit is contained in:
James Page 2014-05-02 11:06:23 +01:00
commit 0f4aefaeb3
2 changed files with 5 additions and 2 deletions

View File

@ -627,7 +627,10 @@ def ssh_compute_remove(public_key, user=None):
[keys.remove(key) for key in keys if key == public_key]
with open(authorized_keys(user), 'w') as _keys:
_keys.write('\n'.join(keys) + '\n')
keys = '\n'.join(keys)
if not keys.endswith('\n'):
keys += '\n'
_keys.write(keys)
def determine_endpoints(url):

View File

@ -405,7 +405,7 @@ class NovaCCUtilsTests(CharmTestCase):
"\nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC27Us7lSjCpa7bumXAgc "
"nova-compute-1\n"
"ssh-rsa CCCCB3NzaC1yc2ECCCCDCQCBCCCBCQC27Us7lSjCpa7bumXCgc "
"nova-compute-3\n\n"
"nova-compute-3\n"
)
isfile.return_value = True
self.remote_unit.return_value = 'nova-compute/2'