[FIX] test_http: unreliable tests

Part-of: odoo/odoo#91927
This commit is contained in:
Julien Castiaux
2022-05-23 08:29:55 +02:00
committed by Christophe Monniez
parent d2b7a601ba
commit 8f52bdf9f4
+3 -1
View File
@@ -1,5 +1,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details. # Part of Odoo. See LICENSE file for full copyright and licensing details.
import html
import json import json
from unittest.mock import patch from unittest.mock import patch
from urllib.parse import urlparse from urllib.parse import urlparse
@@ -380,7 +381,7 @@ class TestHttpModels(TestHttpBase):
milky_way = self.env.ref('test_http.milky_way') milky_way = self.env.ref('test_http.milky_way')
res = self.url_open(f'/test_http/{milky_way.id}/9999') # unknown gate res = self.url_open(f'/test_http/{milky_way.id}/9999') # unknown gate
self.assertEqual(res.status_code, 400) self.assertEqual(res.status_code, 400)
self.assertIn("The goa'uld destroyed the gate", res.text) self.assertIn("The goa'uld destroyed the gate", html.unescape(res.text))
@tagged('post_install', '-at_install') @tagged('post_install', '-at_install')
@@ -510,6 +511,7 @@ class TestHttpEnsureDb(TestHttpBase):
self.assertEqual(new_session.uid, None) self.assertEqual(new_session.uid, None)
# follow redirection # follow redirection
self.opener.cookies['session_id'] = new_session.sid
res = self.multidb_url_open('/test_http/ensure_db') res = self.multidb_url_open('/test_http/ensure_db')
res.raise_for_status() res.raise_for_status()
self.assertEqual(res.status_code, 200) self.assertEqual(res.status_code, 200)