Skip to content

Commit

Permalink
[FIX] auth_sms: http.Root() ==> http.root
Browse files Browse the repository at this point in the history
  • Loading branch information
NL66278 committed Jan 10, 2025
1 parent 317fe99 commit ae2c90e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions auth_sms/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
class Common(TransactionCase):
def setUp(self):
super(Common, self).setUp()
self.odoo_root = http.Root()
self.session = self.odoo_root.session_store.new()
self.session = http.root.session_store.new()
self.env["res.users"]._register_hook()
self.demo_user = self.env.ref("auth_sms.demo_user")
self.env["auth_sms.code"].search([]).unlink()
Expand All @@ -33,10 +32,10 @@ def _request(self, path, method="POST", data=None):
},
).get_environ()
werkzeug_request = WerkzeugRequest(werkzeug_env)
self.odoo_root.setup_session(werkzeug_request)
http.root.setup_session(werkzeug_request)
werkzeug_request.session.db = self.env.cr.dbname
self.odoo_root.setup_db(werkzeug_request)
self.odoo_root.setup_lang(werkzeug_request)
http.root.setup_db(werkzeug_request)
http.root.setup_lang(werkzeug_request)

request = http.HttpRequest(werkzeug_request)
request._env = self.env
Expand Down
4 changes: 3 additions & 1 deletion auth_sms/tests/test_auth_sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from unittest.mock import patch

from odoo import http

from .common import Common


Expand Down Expand Up @@ -37,7 +39,7 @@ def test_auth_sms_login(self):
self.assertEqual(response.template, "auth_sms.template_code")
self.assertTrue(request.session["auth_sms.password"])
mock_request_post.assert_called_once()
self.odoo_root.session_store.save(request.session)
http.root.session_store.save(request.session)

# then fill in a wrong code
with self._request(
Expand Down

0 comments on commit ae2c90e

Please sign in to comment.