@patch('requests.get')
    def test_internal_error(self, r_get):
        # This is unconfirmed; haven't been able to verify this response from API.
        r_get.return_value = Mock(
            status_code=500,
            text='An unhandled error with the Xero API occurred. Contact the Xero API team if problems persist.'
        )

        credentials = Mock(base_url="")
        xero = Xero(credentials)

        try:
            xero.contacts.all()
            self.fail("Should raise a XeroInternalError.")

        except XeroInternalError as e:
            # Error messages have been extracted
            self.assertEqual(str(e), 'An unhandled error with the Xero API occurred. Contact the Xero API team if problems persist.')

            # The response has also been stored
            self.assertEqual(e.response.status_code, 500)
            self.assertEqual(e.response.text, 'An unhandled error with the Xero API occurred. Contact the Xero API team if problems persist.')
        except Exception as e:
            self.fail("Should raise a XeroInternalError, not %s" % e)
Constructor.
dataset/ETHPy150Open freakboy3742/pyxero/tests/exceptions.py/ExceptionsTest.test_internal_error--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/datastore/datastore_query.py/Cursor.__init__