'Test that management command completes with proper message for errors
and logs correct information.'

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

    self.__create_saml_configurations__()
    expected = '\nDone.\n1    provider(s)    found    in    database.\n0    skipped    and    1    attempted.\n0    updated    and    1    failed.\n'
    with self.assertRaisesRegexp(CommandError, 'HTTPError:    404    Client    Error'):
        call_command('saml', pull=True, stdout=self.stdout)
    self.assertIn(expected, self.stdout.getvalue())
