def test_remote_authentication_failed_becomes_remote_initiated_server_error( self): """Simulate the message we get when the error message is 'Authentication failed' but our authentication information is set up correctly. """ msg = self.sample_data("error_authentication_failed.xml") error = ErrorParser().process_all(msg) assert isinstance(error, RemoteInitiatedServerError) eq_(BibliothecaAPI.SERVICE_NAME, error.service_name) eq_("Authentication failed", error.message)
def test_blank_error_message_becomes_remote_initiated_server_error(self): msg = """<Error xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Message/></Error>""" error = ErrorParser().process_all(msg) assert isinstance(error, RemoteInitiatedServerError) eq_(BibliothecaAPI.SERVICE_NAME, error.service_name) eq_("Unknown error", error.message)
def test_exceeded_hold_limit(self): msg = self.sample_data("error_exceeded_hold_limit.xml") error = ErrorParser().process_all(msg) assert isinstance(error, PatronHoldLimitReached) eq_(u'Patron cannot have more than 15 holds', error.message)
def test_malformed_error_message_becomes_remote_initiated_server_error(self): msg = """<weird>This error does not follow the standard set out by 3M.</weird>""" error = ErrorParser().process_all(msg) assert isinstance(error, RemoteInitiatedServerError) eq_(BibliothecaAPI.SERVICE_NAME, error.service_name) eq_("Unknown error", error.message)