예제 #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)
예제 #2
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)