def test_get_wsfed_wrong_XML(self):
     """
     The incoming value is valid XML but not the correct XML. It should
     handle that!
     """
     result = get_wsfed('<xml/>')
     self.assertEqual('', result)
Example #2
0
 def test_get_wsfed_(self):
     """
     Given some valid XML expressed as a string the function should return
     a single string that is the WSFED endpoint.
     """
     result = get_wsfed(METADATA.replace(u'\ufeff', ''))
     self.assertEqual('https://login.windows.net/03159e92-72c6-4b23-a64a-af50e790adbf/wsfed', result)
Example #3
0
 def test_get_wsfed_wrong_XML(self):
     """
     The incoming value is valid XML but not the correct XML. It should
     handle that!
     """
     result = get_wsfed('<xml/>')
     self.assertEqual('', result)
 def test_get_wsfed_(self):
     """
     Given some valid XML expressed as a string the function should return
     a single string that is the WSFED endpoint.
     """
     result = get_wsfed(METADATA.replace(u'\ufeff', ''))
     self.assertEqual(
         'https://login.windows.net/03159e92-72c6-4b23-a64a-af50e790adbf/wsfed',
         result)
 def test_get_wsfed_not_XML(self):
     """
     Since we're parsing a value from an external third party, ensure we
     recover gracefully from crap-in.
     """
     # Mocking the log ensures we know the exception has been handled.
     with mock.patch('ckanext.adfs.metadata.log.error') as mock_logger:
         result = get_wsfed('not xml')
         self.assertEqual(3, mock_logger.call_count)
         self.assertEqual('', result)
Example #6
0
 def test_get_wsfed_not_XML(self):
     """
     Since we're parsing a value from an external third party, ensure we
     recover gracefully from crap-in.
     """
     # Mocking the log ensures we know the exception has been handled.
     with mock.patch('ckanext.adfs.metadata.log.error') as mock_logger:
         result = get_wsfed('not xml')
         self.assertEqual(3, mock_logger.call_count)
         self.assertEqual('', result)