'L{KnownHostsFile.hasHostKey} raises L{HostKeyChanged} if the host key is
present in memory (but not yet saved), but different from the expected
one.  The resulting exception has a C{offendingEntry} indicating the
given entry, but no filename or line number information (reflecting the
fact that the entry exists only in memory).'

def test_unsavedEntryHasKeyMismatch(self):

    hostsFile = KnownHostsFile(FilePath(self.mktemp()))
    entry = hostsFile.addHostKey('www.example.com', Key.fromString(otherSampleKey))
    exception = self.assertRaises(HostKeyChanged, hostsFile.hasHostKey, 'www.example.com', Key.fromString(thirdSampleKey))
    self.assertEqual(exception.offendingEntry, entry)
    self.assertIsNone(exception.lineno)
    self.assertIsNone(exception.path)
