File: test_page_manager.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 (28 lines) | stat: -rw-r--r-- 1,587 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
27
28
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

import odoo.tests


@odoo.tests.common.tagged('post_install', '-at_install')
class TestWebsitePageManager(odoo.tests.HttpCase):
    def test_page_manager_test_model(self):
        if self.env['website'].search_count([]) == 1:
            website2 = self.env['website'].create({
                'name': 'My Website 2',
                'domain': '',
                'sequence': 20,
            })
        else:
            website2 = self.env['website'].search([], order='id desc', limit=1)
        self.env['test.model.multi.website'].create({'name': 'Test Model Multi Website 2', 'website_id': website2.id})
        self.assertTrue(
            len(set([t.website_id.id for t in self.env['test.model.multi.website'].search([])])) >= 3,
            "There should at least be one record without website_id and one for 2 different websites",
        )
        self.assertNotIn('website_id', self.env['test.model']._fields)
        self.start_tour('/odoo/action-test_website.action_test_model_multi_website', 'test_website_page_manager', login="admin")
        # This second test is about ensuring that you can switch from a list
        # view which has no `website_pages_list` js_class to its kanban view
        self.start_tour('/odoo/action-test_website.action_test_model_multi_website_js_class_bug', 'test_website_page_manager_js_class_bug', login="admin")
        self.start_tour('/odoo/action-test_website.action_test_model', 'test_website_page_manager_no_website_id', login="admin")