Example #1
0
 def test_response_verify_failure(self):
     """Test failed verification of response"""
     from Perspectives import NotaryResponse
     from Perspectives import NotaryResponseBadSignature
     from Perspectives import Protocol
     from Perspectives import Service, ServiceType
     notaries = testutils.test_notaries()
     notary = notaries.find_notary("cmu.ron.lcs.mit.edu")
     service = Service("www.citibank.com",
                                    443,
                                    ServiceType.SSL)
     protocol = Protocol(notary, service)
     response_string = testutils.load_response("response-bad.1")
     with self.assertRaises(NotaryResponseBadSignature):
         protocol.parse_response(response_string)
Example #2
0
def create_NotaryResponse():
    """Return a NotaryResponse instance"""
    from Perspectives import NotaryResponse
    from Perspectives import Protocol
    from Perspectives import Service, ServiceType
    notaries = test_notaries()
    notary = notaries.find_notary("cmu.ron.lcs.mit.edu")
    service = Service("www.citibank.com",
                      443,
                      ServiceType.SSL)
    protocol = Protocol(notary, service)
    response_string = load_response("response.1")
    response = protocol.parse_response(response_string)
    return response
Example #3
0
 def test_response_verify(self):
     """Test verification of response"""
     from Perspectives import NotaryResponse
     from Perspectives import Protocol
     from Perspectives import Service, ServiceType
     notaries = testutils.test_notaries()
     notary = notaries.find_notary("cmu.ron.lcs.mit.edu")
     service = Service("www.citibank.com",
                                    443,
                                    ServiceType.SSL)
     protocol = Protocol(notary, service)
     response_string = testutils.load_response("response.1")
     response = protocol.parse_response(response_string)
     self.assertIsNotNone(response)
     self.assertIsInstance(response, NotaryResponse)