def test_duplicate_peer(self): """ Test that a duplicated peer is not added. """ self.db = {'test_hash': [('test', '100.100.100.100', 1000)]} tracker.add_peer(self.db, \ "test_hash", "test", "100.100.100.100", 1000) self.assertEqual(self.db, \ {'test_hash': [('test', '100.100.100.100', 1000)]})
def test_unique_peer(self): """ Test that a unique peer is added correctly. """ self.db = {} tracker.add_peer(self.db, \ "test_hash", "test", "100.100.100.100", 1000) self.assertEqual(self.db, \ {'test_hash': [('test', '100.100.100.100', 1000)]})