Add the support to be able to specify exlicitely module, class and method name in test_tags Before this commit, there is no distinction between module tag and test tag. Meaning that --test-tag module_name will replace the default +standard tag and execute all test of the module. This commit tries to keep the initial behaviour, while addind new features, like explicit modules tag with /module_name, as well as class (:class) and method (.method) Some usage examples: --test_tags /module will execute all standard test of module --test_tags :class will execute all standard test with class name 'class' --test_tags .method will execute all standard test with method name 'method' --test_tags external/module will execute all external test of module --test_tags */module will execute all tests of module, --test_tags */module,-standard will execute all non standard tests of module, --test_tags -/website:TestUiTranslate.test_admin_tour_rte_translator will disable only rte translator test closes odoo/odoo#34756 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
82 lines
2.0 KiB
Python
82 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.http_routing.models.ir_http import slugify, unslug
|
|
from odoo.tests.common import BaseCase
|
|
|
|
|
|
class TestUnslug(BaseCase):
|
|
|
|
def test_unslug(self):
|
|
tests = {
|
|
'': (None, None),
|
|
'foo': (None, None),
|
|
'foo-': (None, None),
|
|
'-': (None, None),
|
|
'foo-1': ('foo', 1),
|
|
'foo-bar-1': ('foo-bar', 1),
|
|
'foo--1': ('foo', -1),
|
|
'1': (None, 1),
|
|
'1-1': ('1', 1),
|
|
'--1': (None, None),
|
|
'foo---1': (None, None),
|
|
'foo1': (None, None),
|
|
}
|
|
|
|
for slug, expected in tests.items():
|
|
self.assertEqual(unslug(slug), expected)
|
|
|
|
class TestTitleToSlug(BaseCase):
|
|
"""
|
|
Those tests should pass with or without python-slugify
|
|
See website/models/website.py slugify method
|
|
"""
|
|
|
|
def test_spaces(self):
|
|
self.assertEqual(
|
|
"spaces",
|
|
slugify(u" spaces ")
|
|
)
|
|
|
|
def test_unicode(self):
|
|
self.assertEqual(
|
|
"heterogeneite",
|
|
slugify(u"hétérogénéité")
|
|
)
|
|
|
|
def test_underscore(self):
|
|
self.assertEqual(
|
|
"one-two",
|
|
slugify(u"one_two")
|
|
)
|
|
|
|
def test_caps(self):
|
|
self.assertEqual(
|
|
"camelcase",
|
|
slugify(u"CamelCase")
|
|
)
|
|
|
|
def test_special_chars(self):
|
|
self.assertEqual(
|
|
"o-d-o-o",
|
|
slugify(u"o!#d{|\o/@~o&%^?")
|
|
)
|
|
|
|
def test_str_to_unicode(self):
|
|
self.assertEqual(
|
|
"espana",
|
|
slugify("España")
|
|
)
|
|
|
|
def test_numbers(self):
|
|
self.assertEqual(
|
|
"article-1",
|
|
slugify(u"Article 1")
|
|
)
|
|
|
|
def test_all(self):
|
|
self.assertEqual(
|
|
"do-you-know-martine-a-la-plage",
|
|
slugify(u"Do YOU know 'Martine à la plage' ?")
|
|
)
|