def test_validate_saml_with_certificate_mismatch(self):
     """
     Ensures that while the certificate in the incoming SAML may be valid,
     it must match the expected certificate passed into the method.
     """
     bad_certs = set(['bad', 'certificates'])
     self.assertFalse(validation.validate_saml(VALID_SAML, bad_certs))
 def test_validate_saml_with_certificate_mismatch(self):
     """
     Ensures that while the certificate in the incoming SAML may be valid,
     it must match the expected certificate passed into the method.
     """
     bad_certs = set(['bad', 'certificates'])
     self.assertFalse(validation.validate_saml(VALID_SAML, bad_certs))
 def test_validate_saml_with_invalid_xml(self):
     """
     Ensure that a response that contains invalid but well formed XML
     returns False and the associated exception is logged.
     """
     with mock.patch('ckanext.adfs.validation.log.error') as mock_logger:
         result = validation.validate_saml("<xml/>", X509)
         self.assertEqual(3, mock_logger.call_count)
         self.assertFalse(result)
 def test_validate_saml_with_non_xml(self):
     """
     Ensure that a response that doesn't contain XML merely returns False
     and the associated exception is logged.
     """
     with mock.patch('ckanext.adfs.validation.log.error') as mock_logger:
         result = validation.validate_saml("Hello world!", X509)
         self.assertEqual(3, mock_logger.call_count)
         self.assertFalse(result)
 def test_validate_saml_with_invalid_xml(self):
     """
     Ensure that a response that contains invalid but well formed XML
     returns False and the associated exception is logged.
     """
     with mock.patch('ckanext.adfs.validation.log.error') as mock_logger:
         result = validation.validate_saml("<xml/>", X509)
         self.assertEqual(3, mock_logger.call_count)
         self.assertFalse(result)
 def test_validate_saml_with_non_xml(self):
     """
     Ensure that a response that doesn't contain XML merely returns False
     and the associated exception is logged.
     """
     with mock.patch('ckanext.adfs.validation.log.error') as mock_logger:
         result = validation.validate_saml("Hello world!", X509)
         self.assertEqual(3, mock_logger.call_count)
         self.assertFalse(result)
 def test_validate_saml(self):
     """
     Ensure that a valid response returns True
     """
     self.assertTrue(validation.validate_saml(VALID_SAML, X509))
 def test_validate_saml(self):
     """
     Ensure that a valid response returns True
     """
     self.assertTrue(validation.validate_saml(VALID_SAML, X509))