From d104ef0a50789cf35c24c7ef796b665b34ad7696 Mon Sep 17 00:00:00 2001 From: "Antoine Vandevenne (anv)" Date: Tue, 16 Aug 2022 15:17:57 +0000 Subject: [PATCH] [FIX] payment: move `_build_url` to the test class that supports it Calling `_build_url` for a test class that only inherited from `PaymentCommon` would raise an error, as the method depends on the `HttpCase` test class that is only inherited by `PaymentHttpCommon`. closes odoo/odoo#95860 Related: odoo/documentation#2532 Signed-off-by: Antoine Vandevenne (anv) --- addons/payment/tests/common.py | 4 ---- addons/payment/tests/http_common.py | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/payment/tests/common.py b/addons/payment/tests/common.py index bc7bf6681f1..45aa009d1a2 100644 --- a/addons/payment/tests/common.py +++ b/addons/payment/tests/common.py @@ -4,7 +4,6 @@ import logging from unittest.mock import patch from lxml import objectify -from werkzeug import urls from odoo.fields import Command from odoo.tools.misc import hmac as hmac_tool @@ -244,9 +243,6 @@ class PaymentCommon(AccountTestInvoicingCommon): access_token = hmac_tool(self.env(su=True), 'generate_access_token', token_str) return access_token - def _build_url(self, route): - return urls.url_join(self.base_url(), route) - def _extract_values_from_html_form(self, html_form): """ Extract the transaction rendering values from an HTML form. diff --git a/addons/payment/tests/http_common.py b/addons/payment/tests/http_common.py index 7f21d114684..2efbe083a9e 100644 --- a/addons/payment/tests/http_common.py +++ b/addons/payment/tests/http_common.py @@ -2,7 +2,9 @@ import json from uuid import uuid4 + from lxml import etree, objectify +from werkzeug import urls from odoo.tests import HttpCase @@ -19,6 +21,9 @@ class PaymentHttpCommon(PaymentCommon, HttpCase): # Helpers # ########### + def _build_url(self, route): + return urls.url_join(self.base_url(), route) + def _make_http_get_request(self, url, params=None): """ Make an HTTP GET request to the provided URL.