<commit_before># -*- coding: utf-8 -*-
# © <2016> <<NAME>, S.A. de C.V.>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp.tests.common import TransactionCase


class TestCvaConfigSettings(TransactionCase):
    """
    This will test model cva config settings
    """
    def setUp(self):
        """
        Define global variables
        """
        super(TestCvaConfigSettings, self).setUp()

    def test_10_cva_config_settings_get_products(self):
        cva_obj = self.env['cva.config.settings']
        cva = cva_obj.create({
            'name': '40762',
            'allowed_groups': [(0, 0, {'name': 'AIRE ACONDICIONADO'})],
        })
        cva.execute()
        cva.get_products()<commit_msg>[ADD][connector_cva] test to get_group method use of mock<commit_after># -*- coding: utf-8 -*-
# © <2016> <<NAME>, S.A. de C.V.>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp.tests.common import TransactionCase
from mock import MagicMock
from lxml import etree


class TestCvaConfigSettings(TransactionCase):
    """
    This will test model cva config settings
    """
    def setUp(self):
        """
        Define global variables
        """
        super(TestCvaConfigSettings, self).setUp()
        self.cva = self.env['cva.config.settings']

    def test_10_cva_config_settings_get_products(self):
        cva = self.cva.create({
            'name': '40762',
            'allowed_groups': [(0, 0, {'name': 'AIRE ACONDICIONADO'})],
        })
        cva.execute()
        cva.get_products()

    def test_20_cva_config_settings_get_groups(self):
        xml = ('<articulos><item><grupo>BACK PACK (MOCHILA)</grupo></item>'
               '</articulos>')
        cva = self.cva.create({
            'name': '40762',
            'main_location': self.env.ref('connector_cva.loc_torreon').id})
        cva.execute()
        cva.connect_cva = MagicMock()
        cva.connect_cva.return_value = etree.XML(xml)
        cva.get_groups()
{'fraction_non_alphanumeric': 0.1466202783300199, 'fraction_numerical': 0.019383697813121274, 'mean_word_length': 2.5691489361702127, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7383604', 'n_tokens_mistral': 695, 'n_tokens_neox': 666, 'n_words': 133}