File: test_web_redirect.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (26 lines) | stat: -rw-r--r-- 979 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from werkzeug.urls import url_parse

from odoo.tests.common import HttpCase


class TestWebRedirect(HttpCase):
    def setUp(self):
        super().setUp()

    def test_web_route_redirect_param_legacy(self):
        # This test is for legacy routes with /web and fragement
        web_response = self.url_open('/web#cids=1&action=887&menu_id=124')
        web_response.raise_for_status()
        response_url_query = url_parse(web_response.url).query

        self.assertEqual(response_url_query, 'redirect=%2Fweb%3F')

    def test_web_route_redirect_param(self):
        # This test if for the new routes with /odoo, pathname and query params
        web_response = self.url_open('/odoo/action-887?cids=1')
        web_response.raise_for_status()
        response_url_query = url_parse(web_response.url).query

        self.assertEqual(response_url_query, 'redirect=%2Fodoo%2Faction-887%3Fcids%3D1')