def test_parse_file(self):
     """Test NotaryParser.parse_file()"""
     from Perspectives import NotaryParser
     parser = NotaryParser()
     notaries = parser.parse_file(self.notary_file)
     self.assertIsNotNone(notaries)
     self.assertEqual(len(notaries), 4)
     for notary in notaries:
         self.assertIsNotNone(notary.hostname)
         self.assertIsNotNone(notary.port)
         self.assertIsNotNone(notary.public_key)
Beispiel #2
0
 def test_find_notary(self):
     """Test find_notary()"""
     from Perspectives import NotaryParser
     notaries = NotaryParser().parse_file(self.notary_file)
     for hostname in [
         "cmu.ron.lcs.mit.edu",
         "convoke.ron.lcs.mit.edu",
         "mvn.ron.lcs.mit.edu",
         "hostway.ron.lcs.mit.edu"
         ]:
         notary = notaries.find_notary(hostname)
         self.assertIsNotNone(notary)
         self.assertEqual(notary.hostname, hostname)
     notary = notaries.find_notary("cmu.ron.lcs.mit.edu", port=8080)
     self.assertIsNotNone(notary)
     self.assertEqual(notary.hostname, "cmu.ron.lcs.mit.edu")
     # Test a failure
     notary = notaries.find_notary("does.not.exist")
     self.assertIsNone(notary)
Beispiel #3
0
def test_notaries():
    """Return test Notaries"""
    from Perspectives import NotaryParser
    parser = NotaryParser()
    notaries = parser.parse_file(notary_file)
    return notaries