*: bus, crm_livechat, crm_mail_plugin, im_livechat, payment, payment_demo, pos_online_payment, test_discuss_full, test_mail_full, tests, website_livechat, website_sale. Several python tests have their own way to make jsonrpc requests. This PR adds a generic `make_jsonrpc_request` method to the `HttpCase` in order to provide a generic way to do so. At the same time, calls to `_open_livechat_channel` are removed in favor of jsonrpc request to `get_session`. This makes the tests more realistics (some incoherences were present like passing `country_id` to the open channel method while the user country id is not set...) Finally, this will ease the diff in the PR introducing livechat visitors as mail guests. part of task-3332628 closes odoo/odoo#130036 Related: odoo/enterprise#44840 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from unittest.mock import patch
|
|
|
|
from odoo.tests import tagged
|
|
|
|
from odoo.addons.payment_demo.controllers.main import PaymentDemoController
|
|
from odoo.addons.payment_demo.tests.common import PaymentDemoCommon
|
|
from odoo.addons.payment.tests.http_common import PaymentHttpCommon
|
|
|
|
|
|
@tagged('-at_install', 'post_install')
|
|
class TestProcessingFlows(PaymentDemoCommon, PaymentHttpCommon):
|
|
|
|
def test_portal_payment_triggers_processing(self):
|
|
""" Test that paying from the frontend triggers the processing of the notification data. """
|
|
self._create_transaction(flow='direct')
|
|
url = self._build_url(PaymentDemoController._simulation_url)
|
|
with patch(
|
|
'odoo.addons.payment.models.payment_transaction.PaymentTransaction'
|
|
'._handle_notification_data'
|
|
) as handle_notification_data_mock:
|
|
self.make_jsonrpc_request(url, params=self.notification_data)
|
|
self.assertEqual(handle_notification_data_mock.call_count, 1)
|