def test_router_ssh_key(self, fake_open):
     mock_key_file = mock.MagicMock(spec=file)
     mock_key_file.read.return_value = 'fake-key'
     mock_key_file.__enter__.return_value = mock_key_file
     fake_open.return_value = mock_key_file
     result = nova._router_ssh_key()
     self.assertEqual(result, 'fake-key')
 def test_router_ssh_key_not_found(self, fake_open, fake_log):
     fake_open.side_effect = IOError
     result = nova._router_ssh_key()
     self.assertEqual(result, '')
     self.assertTrue(fake_log.warning.called)