def test_addHostKey(self):
        """
        L{KnownHostsFile.addHostKey} adds a new L{HashedEntry} to the host
        file, and returns it.
        """
        hostsFile = self.loadSampleHostsFile()
        aKey = Key.fromString(thirdSampleKey)
        self.assertEqual(False,
                         hostsFile.hasHostKey(b"somewhere.example.com", aKey))
        newEntry = hostsFile.addHostKey(b"somewhere.example.com", aKey)

        # The code in OpenSSH requires host salts to be 20 characters long.
        # This is the required length of a SHA-1 HMAC hash, so it's just a
        # sanity check.
        self.assertEqual(20, len(newEntry._hostSalt))
        self.assertEqual(True,
                         newEntry.matchesHost(b"somewhere.example.com"))
        self.assertEqual(newEntry.keyType, b"ssh-rsa")
        self.assertEqual(aKey, newEntry.publicKey)
        self.assertEqual(True,
                         hostsFile.hasHostKey(b"somewhere.example.com", aKey))

        L{KnownHostsFile.addHostKey} adds a new L{HashedEntry} to the host
        file, and returns it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_knownhosts.py