'Verify that the error response is valid.
Subclasses can override this function based on the expected response.'

def assertValidErrorResponse(self, response, expected_status=http_client.BAD_REQUEST):

    self.assertEqual(expected_status, response.status_code)
    error = response.result['error']
    self.assertEqual(response.status_code, error['code'])
    self.assertIsNotNone(error.get('title'))
