From ca4e088448f6dfc5c2de751497b3adbb5ed5c18f Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 9 Mar 2018 10:19:41 +0000 Subject: [PATCH] [FIX] auth_signup_verify_email: Better integration tests - Remove commits in tests. - Bigger timeout. - Run at post-install, since partners are created, which easily leads to `ProgrammingError`s. --- .../tests/test_verify_email.py | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/auth_signup_verify_email/tests/test_verify_email.py b/auth_signup_verify_email/tests/test_verify_email.py index a3649cd7d..daca352a6 100644 --- a/auth_signup_verify_email/tests/test_verify_email.py +++ b/auth_signup_verify_email/tests/test_verify_email.py @@ -5,20 +5,18 @@ from urllib import urlencode from lxml.html import document_fromstring from openerp import _ -from openerp.tests.common import HttpCase +from openerp.tests.common import at_install, post_install, HttpCase +@at_install(False) +@post_install(True) class UICase(HttpCase): def setUp(self): super(UICase, self).setUp() - self.icp = self.env["ir.config_parameter"] - self.old_allow_uninvited = self.icp.get_param( - "auth_signup.allow_uninvited") - self.icp.set_param("auth_signup.allow_uninvited", "True") - - # Workaround https://github.com/odoo/odoo/issues/12237 - self.cr.commit() - + with self.cursor() as http_cr: + http_env = self.env(http_cr) + http_env["ir.config_parameter"].set_param( + "auth_signup.allow_uninvited", "True") self.data = { "csrf_token": self.csrf_token(), "name": "Somebody", @@ -30,14 +28,7 @@ class UICase(HttpCase): "success": _("Check your email to activate your account!"), } - def tearDown(self): - """Workaround https://github.com/odoo/odoo/issues/12237.""" - super(UICase, self).tearDown() - self.icp.set_param( - "auth_signup.allow_uninvited", self.old_allow_uninvited) - self.cr.commit() - - def html_doc(self, url="/web/signup", data=None, timeout=10): + def html_doc(self, url="/web/signup", data=None, timeout=30): """Get an HTML LXML document.""" if data: data = bytes(urlencode(data))