Exemplo n.º 1
0
 def test_ssh_known_host_key(self, _check_output, _known_hosts):
     _known_hosts.return_value = '/foo/known_hosts'
     utils.ssh_known_host_key('test')
     _check_output.assert_called_with(
         ['ssh-keygen', '-f', '/foo/known_hosts',
          '-H', '-F', 'test'])
     _known_hosts.assert_called_with(None, None)
     utils.ssh_known_host_key('test', 'bar')
     _known_hosts.assert_called_with('bar', None)
 def test_ssh_known_host_key(self, _check_output, _known_hosts):
     _known_hosts.return_value = '/foo/known_hosts'
     utils.ssh_known_host_key('test')
     _check_output.assert_called_with(
         ['ssh-keygen', '-f', '/foo/known_hosts',
          '-H', '-F', 'test'])
     _known_hosts.assert_called_with(None, None)
     utils.ssh_known_host_key('test', 'bar')
     _known_hosts.assert_called_with('bar', None)
Exemplo n.º 3
0
 def test_ssh_known_host_key_bug1500589(self, _check_output, _known_hosts):
     """On precise ssh-keygen does not error if host not found in file. So
      check charm processes empty output properly"""
     _known_hosts.return_value = '/foo/known_hosts'
     _check_output.return_value = ''
     key = utils.ssh_known_host_key('test')
     self.assertEquals(key, None)
 def test_ssh_known_host_key_bug1500589(self, _check_output, _known_hosts):
     """On precise ssh-keygen does not error if host not found in file. So
      check charm processes empty output properly"""
     _known_hosts.return_value = '/foo/known_hosts'
     _check_output.return_value = ''
     key = utils.ssh_known_host_key('test')
     self.assertEquals(key, None)