Odoo Help


Test HttpCase Error

Jeferson M. Moreira
on 7/26/16, 10:43 AM 1,293 views

I'm trying to create an test that it makes a http request. But I'm getting an error.


ERROR LROERP3273 openerp.addons.report.tests.test_report_crawl: ` HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.

2016-07-26 14:31:13,782 7084 ERROR LROERP3273 openerp.addons.report.tests.test_report_crawl: ` The last 30x error message was:

2016-07-26 14:31:13,782 7084 ERROR LROERP3273 openerp.addons.report.tests.test_report_crawl: ` FOUND

2016-07-26 14:31:13,782 7084 INFO LROERP3273 openerp.addons.report.tests.test_report_crawl: Ran 1 test in 0.124s

2016-07-26 14:31:13,782 7084 ERROR LROERP3273 openerp.addons.report.tests.test_report_crawl: FAILED

2016-07-26 14:31:13,782 7084 INFO LROERP3273 openerp.addons.report.tests.test_report_crawl:  (errors=1)

016-07-26 14:31:13,783 7084 ERROR LROERP3273 openerp.modules.module: Module report: 0 failures, 1 errors.


import openerp

class TestReportController(openerp.tests.common.HttpCase): 

at_install = False
post_install = True

  def test_report_controller(self):
body = self.url_open('/report/barcode?type=QR&value=Test').read()

Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 7/27/16, 12:13 PM

Hi Jeferson M. Moreira

You can't do it using Odoo unittest cycle because unittests are running in Odoo just after all the modules are loaded into the Registry pool. Controllers as pretty much anything in Odoo are Registry dependent in most cases so after the Registry is loaded and the tests finish to run, you will not be able to reach the url '/report/barcode?type=QR&value=Test' or any other url in Odoo that it's Controller depends on the Registry. 

You need to use something external to run your test case or build an Unittest for Odoo reusing the base clases but run it externally or on demand inside Odoo but not in the normal Odoo test lifecycle.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/26/16, 10:43 AM
Seen: 1293 times
Last updated: 7/28/16, 3:14 AM