예제 #1
0
 def test_ssh_known_hosts_lines(self, _known_hosts):
     _known_hosts.return_value = '/somedir/known_hosts'
     contents = '\n'.join(HOST_KEYS)
     with mock_open('/somedir/known_hosts', contents=contents):
         self.assertEqual(
             ssh_migrations.ssh_known_hosts_lines('nova-compute-lxd'),
             HOST_KEYS)
예제 #2
0
 def test_ssh_authorized_keys_lines(self, _authorized_keys):
     _authorized_keys.return_value = '/somedir/authorized_keys'
     contents = '\n'.join(PUB_KEYS)
     with mock_open('/somedir/authorized_keys', contents=contents):
         self.assertEqual(
             ssh_migrations.ssh_authorized_keys_lines('nova-compute-lxd'),
             PUB_KEYS)
예제 #3
0
 def test_ssh_authorized_key_exists_false(self):
     self.setup_mocks_add_known_host()
     contents = '{}\n'.format(UNIT1_PUBKEY_1)
     with mock_open('/somedir/authorized_keys', contents=contents):
         self.assertFalse(
             ssh_migrations.ssh_authorized_key_exists(
                 UNIT2_PUBKEY_1, 'nova-compute-lxd'))