'Test that management command errors out in case of fatal exceptions instead of failing silently.'

@mock.patch('requests.get', mock_get(status_code=200))
def test_saml_parse_exceptions(self):

    self.__create_saml_configurations__(saml_config={'site__domain': 'third.testserver.fake'}, saml_provider_config={'site__domain': 'third.testserver.fake', 'idp_slug': 'third-test-shib', 'entity_id': 'https://idp.testshib.org/idp/non-existent-shibboleth', 'metadata_source': 'https://www.testshib.org/metadata/third/testshib-providers.xml'})
    expected = '\nDone.\n2    provider(s)    found    in    database.\n1    skipped    and    1    attempted.\n0    updated    and    1    failed.\n'
    with self.assertRaisesRegexp(CommandError, "MetadataParseError:    Can't    find    EntityDescriptor    for    entityID"):
        call_command('saml', pull=True, stdout=self.stdout)
    self.assertIn(expected, self.stdout.getvalue())
