'Verifying a key where the hostname is present but the IP is not should
result in the key being added for the IP and the user being warned
about the change.'

def test_verifyKeyForHostAndIP(self):

    ui = FakeUI()
    hostsFile = self.loadSampleHostsFile()
    expectedKey = Key.fromString(sampleKey)
    hostsFile.verifyHostKey(ui, 'www.twistedmatrix.com', '5.4.3.2', expectedKey)
    self.assertEqual(True, KnownHostsFile.fromPath(hostsFile.savePath).hasHostKey('5.4.3.2', expectedKey))
    self.assertEqual(["Warning:    Permanently    added    the    RSA    host    key    for    IP    address    '5.4.3.2'    to    the    list    of    known    hosts."], ui.userWarnings)
