def testAddContact(self):
        # Create the contact
        h = hashlib.sha1()
        h.update('node2')
        contactID = h.digest()
        contact = lbrynet.dht.contact.Contact(contactID, '127.0.0.1', 91824, self.protocol)
        # Now add it...
        self.routingTable.addContact(contact)
        # ...and request the closest nodes to it (will retrieve it)
        closestNodes = self.routingTable.findCloseNodes(contactID, lbrynet.dht.constants.k)
        self.failUnlessEqual(len(closestNodes), 1, 'Wrong amount of contacts returned; expected 1, got %d' % len(closestNodes))
        self.failUnless(contact in closestNodes, 'Added contact not found by issueing _findCloseNodes()')
Tests if a contact can be added and retrieved correctly
dataset/ETHPy150Open lbryio/lbry/tests/dht/testRoutingTable.py/TreeRoutingTableTest.testAddContact