size int64 0 304k | ext stringclasses 1
value | lang stringclasses 1
value | branch stringclasses 1
value | content stringlengths 0 304k | avg_line_length float64 0 238 | max_line_length int64 0 304k |
|---|---|---|---|---|---|---|
866 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from psycopg2.errorcodes import SERIALIZATION_FAILURE
from psycopg2 import OperationalError
from odoo import http
# Force serialization errors. Patched in some tests.
should_fail = None
class SerializationFailureErro... | 29.862069 | 866 |
316 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Test HTTP',
'version': '1.0',
'category': 'Hidden/Tests',
'description': """A module to test HTTP""",
'depends': ['base', 'web', 'web_tour'],
'installable': True,
'data': [],
'license': 'LGPL-3',
}
| 28.727273 | 316 |
689 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from io import StringIO
from unittest.mock import patch
from odoo.tests import common, tagged
@tagged('-at_install', 'post_install')
class TestHttpUpload(common.HttpCase):
def test_upload_file_retry(self):
... | 40.529412 | 689 |
1,085 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
import sys
from odoo import models, api
class m(models.Model):
""" This model exposes a few methods that will consume between 'almost no
resource' and 'a lot of resource'.
"""
_name = 't... | 24.111111 | 1,085 |
378 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test-limits',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module with dummy methods.""",
'depends': ['base'],
'data': ['ir.model.access.csv'],
'installable': Tr... | 29.076923 | 378 |
9,340 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from __future__ import division
from itertools import count, zip_longest
from odoo import api, fields, models, Command
class A(models.Model):
_name = 'test_testing_utilities.a'
_description = 'Testing Utilities A'
f1 = fields.Char(required=True)
f2 = fields.Integer(default=42... | 29.556962 | 9,340 |
6,079 | py | PYTHON | 15.0 | from lxml.builder import E
from odoo import fields, models, api, Command
class Product(models.Model):
_name = _description = 'ttu.product'
class Root(models.Model):
_name = _description = 'ttu.root'
product_id = fields.Many2one('ttu.product')
product_qty = fields.Integer()
qty_producing = fields... | 38.232704 | 6,079 |
398 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': "Test testing utilities",
'category': "Hidden/Tests",
'description': """Non-trivial testing utilities can require models & all
This here module is useful to validate that they're doing what they're
supposed to do
""",
'depends': ['base'],
'data': [
... | 24.875 | 398 |
3,465 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import itertools
from unittest import mock, TestCase
import psycopg2
from odoo.exceptions import AccessError
from odoo.sql_db import BaseCursor
from odoo.tests import common
from odoo.tools import mute_logger
class Cu... | 38.932584 | 3,465 |
2,302 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
from odoo.tools.xml_utils import _check_with_xsd
import base64
from lxml.etree import XMLSchemaError
class TestLXML(common.TransactionCase):
def test_lxml_import_from_filestore(self):
... | 42.62963 | 2,302 |
25,459 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
"""
Test for the pseudo-form implementation (odoo.tests.common.Form), which should
basically be a server-side implementation of form views (though probably not
complete) intended for properly validating business "view" flows (onchanges,
readonly, required, ...) and make it easier to generate sen... | 32.72365 | 25,459 |
1,655 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
class TestEnv(TransactionCase):
@classmethod
def setUpClass(cls):
super(TestEnv, cls).setUpClass()
user = cls.env['res.users'].create({
... | 37.613636 | 1,655 |
4,785 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from lxml import etree
from odoo.tests import common
from odoo.tools.xml_utils import cleanup_xml_node
class TestXMLTools(common.TransactionCase):
def setUp(self):
super(TestXMLTools, self).setUp()
... | 31.480263 | 4,785 |
2,346 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.exceptions
from odoo import models, api
from odoo.tools.safe_eval import safe_eval
class m(models.Model):
""" This model exposes a few methods that will raise the different
exceptions that must b... | 35.014925 | 2,346 |
398 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test-exceptions',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to generate exceptions.""",
'depends': ['base'],
'data': ['view.xml', 'ir.model.access.csv'],
... | 30.615385 | 398 |
763 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo import models, fields, _
class m(models.TransientModel):
""" A model to provide source strings. """
_name = 'test.translation.import'
_description = 'Test: Translation Import'
name = fields.Char('1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB',
... | 30.52 | 763 |
500 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-translation-import',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to test translation import.""",
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'view.xml'
],
'installable': True,
'aut... | 25 | 500 |
18,977 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from contextlib import closing
import base64
import io
import odoo
from odoo.tests import common, tagged
from odoo.tools.misc import file_open, mute_logger
from odoo.tools.translate import _, _lt, TranslationFileReader, TranslationModuleReader
from odoo import Command
TRANSLATED_TERM = _lt("... | 43.57931 | 18,957 |
363 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Tests flow of API keys',
'category': 'Tools',
'depends': ['web_tour'],
'assets': {
'web.assets_tests': [
# inside .
'test_apikeys/static/tests/apikey_flow.js',
... | 25.928571 | 363 |
1,248 | py | PYTHON | 15.0 | import json
from odoo import api
from odoo.tests import tagged, HttpCase, get_db_name
@tagged('post_install', '-at_install')
class TestAPIKeys(HttpCase):
def setUp(self):
super().setUp()
self.messages = []
@api.model
def log(inst, *args, **kwargs):
self.messages.append... | 33.72973 | 1,248 |
268 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': "test_search_panel",
'description': "Tests for the search panel python methods",
'category': 'Hidden/Tests',
'version': '0.1',
'depends': ['web'],
'data': ['ir.model.access.csv'],
'license': 'LGPL-3',
}
| 20.615385 | 268 |
23,370 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
import odoo.tests
import json
SEARCH_PANEL_ERROR = {'error_msg': "Too many items to display.", }
@odoo.tests.tagged('post_install', '-at_install')
class TestSelectRangeMulti(odoo.tests.TransactionCase):
def setUp(self):
super().setUp()
self.SourceModel = self.env['test_se... | 34.166667 | 23,370 |
23,964 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
import odoo.tests
SEARCH_PANEL_ERROR = {'error_msg': "Too many items to display.", }
@odoo.tests.tagged('post_install', '-at_install')
class TestSelectRange(odoo.tests.TransactionCase):
def setUp(self):
super().setUp()
self.SourceModel = self.env['test_search_panel.source... | 33.895332 | 23,964 |
1,583 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo import fields, models
class SourceModel(models.Model):
_name = 'test_search_panel.source_model'
_description = 'Source Model'
name = fields.Char('Name', required=True)
state = fields.Selection([('a', "A"), ('b', "B")])
folder_id = fields.Many2one('test_search_pan... | 34.413043 | 1,583 |
244 | py | PYTHON | 15.0 | {
'name': 'test module to test data only modules',
'description': 'Fake module to test data module installation without __init__.py',
'version': '0.0.1',
'category': 'Hidden/Tests',
'sequence': 0,
'license': 'LGPL-3',
}
| 30.5 | 244 |
313 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-lint',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to test Odoo code with various linters.""",
'maintainer': 'Odoo SA',
'depends': ['base'],
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
}
| 26.083333 | 313 |
5,714 | py | PYTHON | 15.0 | import os
import astroid
from pylint import checkers, interfaces
DFTL_CURSOR_EXPR = [
'self.env.cr', 'self._cr', # new api
'self.cr', # controllers and test
'cr', # old api
]
class OdooBaseChecker(checkers.BaseChecker):
__implements__ = interfaces.IAstroidChecker
name = 'odoo'
msgs = {
... | 38.08 | 5,712 |
3,885 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# pylint: disable=unbalanced-tuple-unpacking
import logging
import re
from odoo import tools
from odoo.modules import get_resource_from_path
from . import lint_case
_logger = logging.getLogger(__name__)
TSTRING_RE = ... | 35 | 3,885 |
1,800 | py | PYTHON | 15.0 | import ast
import itertools
import os
from . import lint_case
class OnchangeChecker(lint_case.NodeVisitor):
def matches_onchange(self, node):
if isinstance(node, ast.Call):
if isinstance(node.func, ast.Attribute):
return node.func.attr == 'onchange'
if isinstance(n... | 37.5 | 1,800 |
1,696 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import ast
import itertools
import os
from . import lint_case
class L10nChecker(lint_case.NodeVisitor):
def matches_tagged(self, node):
if isinstance(node, ast.Call):
if isinstance(node.func, a... | 33.254902 | 1,696 |
853 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from pathlib import Path
from odoo.modules import get_modules, get_module_path
from . import lint_case
_logger = logging.getLogger(__name__)
# whitelist that allow data modules only
WHITELIST = ['test_d... | 34.12 | 853 |
2,984 | py | PYTHON | 15.0 | import json
import os
import tempfile
import unittest
from subprocess import run, PIPE
from textwrap import dedent
from odoo import tools
from odoo.tests.common import TransactionCase
try:
import pylint
except ImportError:
pylint = None
try:
pylint_bin = tools.which('pylint')
except IOError:
pylint_bi... | 32.791209 | 2,984 |
1,013 | py | PYTHON | 15.0 | import ast
import fnmatch
import os
j = os.path.join
from odoo.modules import get_modules, get_module_path
from odoo.tests import BaseCase
class LintCase(BaseCase):
""" Utility method for lint-type cases
"""
def iter_module_files(self, *globs):
""" Yields the paths of all the module files matchi... | 28.138889 | 1,013 |
1,291 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import os
import odoo
from . import lint_case
_logger = logging.getLogger(__name__)
MARKERS = [b'<' * 7, b'>' * 7]
EXTENSIONS = ('.py', '.js', '.xml', '.less', '.sass')
class TestConflictMarkers(lint_c... | 32.275 | 1,291 |
2,956 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
try:
import pylint
except ImportError:
pylint = None
import subprocess
import os
from os.path import join
from odoo.tests.common import TransactionCase
from odoo import tools
from odoo.modules imp... | 32.130435 | 2,956 |
1,455 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import os
import re
import subprocess
from unittest import skipIf
from odoo import tools
from odoo.modules import get_modules, get_module_path
from . import lint_case
MAX_ES_VERSION = 'es10'
_logger = l... | 32.333333 | 1,455 |
1,262 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import Counter
from odoo.modules import get_modules, get_resource_path
from odoo.tests.common import TransactionCase
from odoo.tools.translate import TranslationFileReader
class PotLinter(TransactionC... | 43.517241 | 1,262 |
1,842 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import re
import subprocess
from unittest import skipIf
from odoo import tools
from . import lint_case
RULES = ('{'
'"no-undef": "error",'
'"no-restricted-globals": ["error", "event", "se... | 28.78125 | 1,842 |
856 | py | PYTHON | 15.0 | import os
import astroid
from pylint import checkers, interfaces
class OdooBaseChecker(checkers.BaseChecker):
__implements__ = interfaces.IAstroidChecker
name = 'odoo'
msgs = {
'E8502': (
'Bad usage of _, _lt function.',
'gettext-variable',
'See https://www.od... | 30.571429 | 856 |
1,230 | py | PYTHON | 15.0 | import astroid
from pylint import checkers, interfaces
class OdooBaseChecker(checkers.BaseChecker):
__implements__ = interfaces.IAstroidChecker
name = 'odoo'
msgs = {
'E8503': (
'Raise inside unlink override.',
'raise-unlink-override',
'Raising errors is not al... | 34.166667 | 1,230 |
219 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': "Test Performance",
'version': "1.0",
'category': "Hidden",
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
],
'license': 'LGPL-3',
}
| 19.909091 | 219 |
21,282 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import defaultdict
import json
from odoo.addons.base.tests.common import SavepointCaseWithUserDemo
from odoo.tests.common import TransactionCase, users, warmup, tagged
from odoo.tools import mute_logger... | 38.139785 | 21,282 |
2,140 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, tools
class BaseModel(models.Model):
_name = 'test_performance.base'
_description = 'Test Performance Base'
name = fields.Char()
value = fields.Integer(default=0)
... | 31.014493 | 2,140 |
227 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
# We add a field on this model
class Unit(models.Model):
_inherit = 'test.unit'
second_name = fields.Char()
| 22.7 | 227 |
400 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test-inherits-depends',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to verify the inheritance using _inherits in non-original modules.""",
'depends': ['test_inherits'],
'data': [],... | 30.769231 | 400 |
1,226 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class test_inherits(common.TransactionCase):
def test_ir_model_data_inherits_again(self):
""" Re-run test_inherits test to make sure another imd hasn't been created """
IrModelData = self.env... | 42.275862 | 1,226 |
4,648 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
# We create a new model
class mother(models.Model):
_name = 'test.inherit.mother'
_description = 'Test Inherit Mother'
name = fields.Char(default='Foo')
state = fiel... | 28.869565 | 4,648 |
367 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-inherit',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to verify the inheritance.""",
'depends': ['base', 'test_new_api'],
'data': [
'ir.model.access.csv',
'demo_data.xml',
],
'installable': True,
'au... | 24.466667 | 367 |
8,031 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.base.tests.common import TransactionCaseWithUserDemo
from odoo.tests import common
class test_inherits(common.TransactionCase):
def test_00_inherits(self):
""" Check that a many2one field w... | 45.630682 | 8,031 |
1,691 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, SUPERUSER_ID
class test_model(models.Model):
_name = 'test_converter.test_model'
_description = 'Test Converter Model'
char = fields.Char()
integer = fields.Integer... | 36.586957 | 1,683 |
417 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test-field-converter',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """Tests of field conversions""",
'maintainer': 'OpenERP SA',
'depends': ['base'],
'data': ['ir.mo... | 29.785714 | 417 |
12,128 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import datetime
import os
import re
from odoo.tests import common
from odoo.tools import html_escape as e
directory = os.path.dirname(__file__)
class TestExport(common.TransactionCase):
_model = None
... | 34.067416 | 12,128 |
865 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestGBF(common.TransactionCase):
def test_group_by_full(self):
Sub = self.env['test_converter.test_model.sub']
TM = self.env['test_converter.test_model']
... | 39.318182 | 865 |
2,290 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-assetsbundle',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to verify the Assets Bundle mechanism.""",
'maintainer': 'Odoo SA',
'depends': ['base'],
'installable': True,
'data': [
"data/ir_asset.xml",
"vi... | 36.349206 | 2,290 |
80,378 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import Counter
from lxml import etree
import os
import time
from unittest import skip
from unittest.mock import patch
import textwrap
import pathlib
import lxml
import base64
from odoo import api, http
... | 42.70882 | 80,378 |
3,670 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import tagged
from odoo.tests.common import TransactionCase
from odoo.tools import URL_RE, ODOO_MODULE_RE
@tagged('post_install', '-at_install')
class TestJsTranspiler(TransactionCase):
def test_cor... | 43.690476 | 3,670 |
11,381 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import tagged
from odoo.tests.common import TransactionCase
from odoo.tools import transpile_javascript
@tagged('post_install', '-at_install')
class TestJsTranspiler(TransactionCase):
maxDiff = None... | 27.227273 | 11,381 |
436 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import SUPERUSER_ID
from odoo.http import Controller, request, route
class TestAssetsBundleController(Controller):
@route('/test_assetsbundle/js', type='http', auth='user')
def bundle(self):
en... | 39.636364 | 436 |
789 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Test API',
'version': '1.0',
'category': 'Hidden/Tests',
'description': """A module to test the API.""",
'depends': ['base', 'web', 'web_tour'],
'installable': True,
'auto_install':... | 27.206897 | 789 |
1,261 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.tests.common import TransactionCase
class Many2manyCase(TransactionCase):
def setUp(self):
super().setUp()
self.ship = self.env['test_new_api.ship'].create({'name': 'Colombus'})
# the ship contains one prisoner
self.env['test_new_api.prisoner'].cre... | 40.677419 | 1,261 |
1,984 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.tests
from odoo.tools import mute_logger
from odoo.addons.base.tests.common import HttpCaseWithUserDemo
@odoo.tests.common.tagged('post_install', '-at_install')
class TestUi(HttpCaseWithUserDemo):
def ... | 48.365854 | 1,983 |
25,128 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.models import MetaModel
from odoo.tests import common
from odoo.addons.base.models.ir_model import model_xmlid, field_xmlid, selection_xmlid
def get_model_name(cls):
name = cls._name
if not name:
[name] = cls._inherit if isinstance(cls._inherit, list) else [cls._inher... | 43.398964 | 25,128 |
1,669 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.tests import common
class test_domain(common.TransactionCase):
def setUp(self):
super(test_domain, self).setUp()
self.bool = self.env['domain.bool']
def test_00_test_bool_undefined(self):
"""
Check that undefined/empty values in database is e... | 40.707317 | 1,669 |
2,166 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.tests import common
class TestFloatExport(common.TransactionCase):
def get_converter(self, name):
FloatField = self.env['ir.qweb.field.float']
_, precision = self.env['decimal.precision.test']._fields[name].get_digits(self.env) or (None, None)
def conve... | 32.818182 | 2,166 |
161,247 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
#
# test cases for new-style fields
#
import base64
from collections import OrderedDict
from datetime import date, datetime, time
import io
from PIL import Image
import psycopg2
from odoo import models, fields, Command
... | 43.439386 | 161,247 |
37,013 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from unittest.mock import patch
from odoo.addons.base.tests.common import SavepointCaseWithUserDemo
from odoo.tests import common, Form
from odoo import Command
def strip_prefix(prefix, names):
size = len(prefix)
... | 39.713519 | 37,013 |
14,371 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.tests.common import TransactionCase
from odoo.exceptions import MissingError
from odoo import Command
class One2manyCase(TransactionCase):
def setUp(self):
super(One2manyCase, self).setUp()
self.Line = self.env["test_new_api.multi.line"]
self.multi = self.... | 43.680851 | 14,371 |
330 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.tests import common
class TestAttributes(common.TransactionCase):
def test_we_cannot_add_attributes(self):
Model = self.env['test_new_api.category']
instance = Model.create({'name': 'Foo'})
with self.assertRaises(AttributeError):
instance.unk... | 27.5 | 330 |
9,114 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.exceptions import UserError, AccessError
from odoo.tests import common
from odoo.tools import frozendict
from odoo import Command
class TestCompanyCheck(common.TransactionCase):
def setUp(self):
super(TestCompanyCheck, self).setUp()
self.company_a = self.env['re... | 41.616438 | 9,114 |
51,498 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
from odoo import models, fields, api, _, Command
from odoo.exceptions import AccessError, ValidationError
class Category(models.Model):
_name = 'test_new_api.category'
_description = 'Test New ... | 35.34523 | 51,498 |
6,189 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
def selection_fn(model):
return [(str(key), val) for key, val in enumerate(["Corge", "Grault", "Wheee", "Moog"])]
def compute_fn(records):
for record in records:
re... | 33.274194 | 6,189 |
313 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-import-export',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to test import/export.""",
'depends': ['base'],
'data': ['ir.model.access.csv'],
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
}
| 26.083333 | 313 |
55,404 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
import pkgutil
import re
from odoo import fields
from odoo.addons.base.tests.common import SavepointCaseWithUserDemo
from odoo.tests import common
from odoo.tools.misc import mute_logger
def message(msg, ty... | 37.722563 | 55,339 |
23,925 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import itertools
import pstats
from cProfile import Profile
from odoo import fields, Command
from odoo.tests import common
class CreatorCase(common.TransactionCase):
model_name = False
def __init__(self, *arg... | 31.646825 | 23,925 |
955 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class TestModel(models.Model):
_name = 'test_convert.test_model'
_description = "Test Convert Model"
@api.model
def action_test_date(self, today_date):
retur... | 27.285714 | 955 |
317 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test_convert',
'description': "Data for xml conversion tests",
'version': '0.0.1',
'category': 'Hidden/Tests',
'data': [
'ir.model.access.csv',
],
'license': 'LGPL-3',
}
| 24.384615 | 317 |
5,128 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
"""
Tests the ability to update environmental information on various nodes (e.g.
change user, add context keys, ...)
"""
import os.path
from lxml import etree
from lxml.builder import E
from odoo.tests import common
from odoo.tools import config
from odoo.tools.convert import xml_import
odoo ... | 30.891566 | 5,128 |
6,284 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import collections
import unittest
from lxml import etree as ET
from lxml.builder import E
import odoo
from odoo.tests import common
from odoo.tools.convert import xml_import, _eval_xml
Field = E.field
Value = E.value... | 31.898477 | 6,284 |
3,496 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
from odoo.tools import populate, pycompat
class TestPopulateModel(models.Model):
_name = 'test.populate'
_description = 'Test Populate'
name = fields.Char(default='Foo... | 36.416667 | 3,496 |
311 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-populate',
'version': '0.1',
'category': 'Tests',
'description': """A module to test populate.""",
'depends': ['base'],
'data': [
'ir.model.access.csv',
],
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
}
| 22.214286 | 311 |
7,205 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import collections
import logging
from odoo.tests import common
from odoo.cli.populate import Populate
from odoo.tools import mute_logger, populate
from unittest.mock import patch
_logger = logging.getLogger(__name__)
... | 46.483871 | 7,205 |
580 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ModelA(models.Model):
_name = "test_rpc.model_a"
_description = "Model A"
name = fields.Char(required=True)
field_b1 = fields.Many2one("test_rpc.model_b", string="... | 29 | 580 |
313 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
"name": "Test RPC",
"version": "1.0",
"category": "Hidden/Tests",
"description": """A module to test the RPC requests.""",
"depends": ["base", "web"],
"installable": True,
"auto_install": False,
"data": ["ir.model.access.csv"],
'license': 'LGPL-3',
}
| 26.083333 | 313 |
2,878 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from functools import partial
from odoo.tests import common, tagged
from odoo.tools.misc import mute_logger
@tagged('-at_install', 'post_install')
class TestError(common.HttpCase):
def setUp(self):
super(TestError, self).setUp()
uid = self.ref("base.user_admin")
s... | 41.114286 | 2,878 |
225 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class PublishedFoo(models.Model):
_name = 'test_new_api.foo'
_inherit = ['test_new_api.foo', 'test_inherit.mixin']
| 28.125 | 225 |
388 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'test-inherit-depends',
'version': '1.0',
'category': 'Hidden/Tests',
'description': """A module to verify the inheritance using _inherit across modules.""",
'depends': ['test_inherit', 'test_new_api'],
'instal... | 32.333333 | 388 |
764 | py | PYTHON | 15.0 | # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestInheritDepends(common.TransactionCase):
def test_inherited_field_external_id(self):
# Module A defines model M, module B defines a mixin (abstract model) X,
# and module C extends M ... | 44.941176 | 764 |
2,468 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import ValidationError
# We just create a new model
class Unit(models.Model):
_name = 'test.unit'
_description = 'Test Unit'
name = fields.Char('Name', required=True, translate=True)
state = fields.Selection([('a', 'A')... | 31.641026 | 2,468 |
440 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
{
'name': 'test-inherits',
'version': '0.1',
'category': 'Hidden/Tests',
'description': """A module to verify the inheritance using _inherits.""",
'author': 'Camptocamp',
'website': 'http://www.camptocamp.com',
'depends': ['base'],
'data': [
'ir.model.acce... | 25.882353 | 440 |
6,581 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
from odoo.tests import common
from odoo.exceptions import ValidationError
from odoo import Command
class test_inherits(common.TransactionCase):
def test_create_3_levels_inherits(self):
""" Check that we can create an inherits on 3 levels """
pallet = self.env['test.pallet'... | 43.582781 | 6,581 |
240 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Tests that custom auth works & is not impaired by CORS',
'category': 'Hidden',
'data': [],
'license': 'LGPL-3',
}
| 30 | 240 |
2,065 | py | PYTHON | 15.0 | from http import HTTPStatus
import odoo.tools
from odoo.tests import HttpCase, HOST
class TestCustomAuth(HttpCase):
# suppress "WARNING: Access Error" when auth fails on json endpoints
@odoo.tools.mute_logger('odoo.http')
def test_json(self):
# straight request should fail
r = self.url_op... | 44.891304 | 2,065 |
3,359 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Base',
'version': '1.3',
'category': 'Hidden',
'description': """
The kernel of Odoo, needed for all installation.
===================================================
""",
'depends': [],
... | 35.357895 | 3,359 |
1,561 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import models
from odoo.tools import populate
_logger = logging.getLogger(__name__)
class Users(models.Model):
_inherit = "res.users"
_populate_sizes = {
'small': 10,
... | 35.477273 | 1,561 |
1,766 | py | PYTHON | 15.0 | import collections
import logging
from odoo import models, Command
from odoo.tools import populate
_logger = logging.getLogger(__name__)
class Partner(models.Model):
_inherit = "res.company"
_populate_sizes = {
'small': 5,
'medium': 10,
'large': 50,
}
def _populate_factorie... | 41.069767 | 1,766 |
1,173 | py | PYTHON | 15.0 | from dateutil.relativedelta import relativedelta
from datetime import date
from odoo import models, Command
from odoo.tools import populate
class ResCurrencyRate(models.Model):
_inherit = "res.currency.rate"
_populate_sizes = {
'small': 100,
'medium': 1000,
'large': 10000,
}
... | 32.583333 | 1,173 |
8,505 | py | PYTHON | 15.0 |
import collections
import logging
from odoo import models
from odoo.tools import populate
_logger = logging.getLogger(__name__)
class Partner(models.Model):
_inherit = "res.partner"
_populate_dependencies = ["res.company", "res.partner.industry"]
_populate_sizes = {
'small': 100,
'medi... | 50.190476 | 8,432 |
3,883 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import exceptions
from odoo.tests.common import TransactionCase, tagged
_logger = logging.getLogger(__name__)
class TestResConfig(TransactionCase):
def setUp(self):
super(TestRes... | 39.222222 | 3,883 |
14,117 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import binascii
import hashlib
import io
import os
from PIL import Image
from odoo.exceptions import AccessError
from odoo.tests.common import TransactionCase
from odoo.tools import image_to_base64
HASH_S... | 44.253918 | 14,117 |
2,405 | py | PYTHON | 15.0 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import TransactionCase, tagged, Form
@tagged('-at_install', 'post_install')
class TestFormCreate(TransactionCase):
"""
Test that the basic Odoo models records can be created on
the interface... | 36.439394 | 2,405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.