def setUp(self):
     super(LDAPAuthenticationTestCase, self).setUp()
     methods = config.get('session', 'authentications')
     config.set('session', 'authentications', 'ldap')
     self.addCleanup(config.set, 'session', 'authentications', methods)
     config.add_section(section)
     config.set(section, 'uri', 'ldap://localhost/dc=tryton,dc=org')
     self.addCleanup(config.remove_section, section)
 def setUp(self):
     super(LDAPAuthenticationTestCase, self).setUp()
     methods = config.get('session', 'authentications')
     config.set('session', 'authentications', 'ldap')
     self.addCleanup(config.set, 'session', 'authentications', methods)
     config.add_section(section)
     config.set(section, 'uri', 'ldap://localhost/dc=tryton,dc=org')
     self.addCleanup(config.remove_section, section)
Exemplo n.º 3
0
    def run(self):
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)

        os.environ['TRYTOND_DATABASE_URI'] = 'sqlite://'
        os.environ['DB_NAME'] = ':memory:'

        from trytond.config import config
        config.add_section('nereid_s3')

        from tests import suite
        test_result = unittest.TextTestRunner(verbosity=3).run(suite())

        if test_result.wasSuccessful():
            sys.exit(0)
        sys.exit(-1)
    def run(self):
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)

        os.environ['TRYTOND_DATABASE_URI'] = 'postgresql://'
        os.environ['DB_NAME'] = 'test_' + str(int(time.time()))

        from trytond.config import config
        # Add elastic search test configuration
        config.add_section('elastic_search')
        config.set('elastic_search', 'server_uri', 'localhost:9200')

        from tests import suite
        test_result = unittest.TextTestRunner(verbosity=3).run(suite())

        if test_result.wasSuccessful():
            sys.exit(0)
        sys.exit(-1)
Exemplo n.º 5
0
    def run(self):
        if self.distribution.tests_require:
            self.distribution.fetch_build_eggs(self.distribution.tests_require)

        os.environ['TRYTOND_DATABASE_URI'] = 'postgresql://'
        os.environ['DB_NAME'] = 'test_' + str(int(time.time()))

        from trytond.config import config
        # Add elastic search test configuration
        config.add_section('elastic_search')
        config.set('elastic_search', 'server_uri', 'localhost:9200')

        from tests import suite
        test_result = unittest.TextTestRunner(verbosity=3).run(suite())

        if test_result.wasSuccessful():
            sys.exit(0)
        sys.exit(-1)
    def setUp(self):
        super(AuthenticationSMSTestCase, self).setUp()
        methods = config.get('session', 'authentications')
        config.set('session', 'authentications', 'password_sms')
        self.addCleanup(config.set, 'session', 'authentications', methods)
        config.add_section('authentication_sms')
        config.set(
            'authentication_sms', 'function',
            'trytond.modules.authentication_sms.tests.send_sms')
        self.addCleanup(config.remove_section, 'authentication_sms')
        del sms_queue[:]

        length = config.get('password', 'length')
        config.set('password', 'length', 4)
        self.addCleanup(config.set, 'password', 'length', length)

        entropy = config.get('password', 'entropy')
        config.set('password', 'entropy', 0.8)
        self.addCleanup(config.set, 'password', 'entropy', entropy)
 def setUp(self):
     super().setUp()
     if not config.has_section('marketing'):
         config.add_section('marketing')
     subscribe_url = config.get('marketing',
                                'email_subscribe_url',
                                default='')
     config.set('marketing', 'email_subscribe_url', SUBSCRIBE_URL)
     self.addCleanup(lambda: config.set('marketing', 'email_subscribe_url',
                                        subscribe_url))
     unsubscribe_url = config.get('marketing',
                                  'email_unsubscribe_url',
                                  default='')
     config.set('marketing', 'email_unsubscribe_url', UNSUBSCRIBE_URL)
     self.addCleanup(lambda: config.set(
         'marketing', 'email_unsubscribe_url', unsubscribe_url))
     spy_pixel = config.get('marketing', 'email_spy_pixel', default='')
     config.set('marketing', 'email_spy_pixel', 'true')
     self.addCleanup(
         lambda: config.set('marketing', 'email_spy_pixel', spy_pixel))
     from_ = config.get('email', 'from', default='')
     config.set('email', 'from', FROM)
     self.addCleanup(lambda: config.set('email', 'from', from_))
Exemplo n.º 8
0
 def setUp(self):
     super(LDAPAuthenticationTestCase, self).setUp()
     config.add_section(section)
     config.set(section, 'uri', 'ldap://localhost/dc=tryton,dc=org')
"""
import time
import datetime
from dateutil.relativedelta import relativedelta
from decimal import Decimal
from pyes.managers import Indices

import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, USER, DB_NAME, CONTEXT
from trytond.transaction import Transaction
from trytond.config import config
from nereid.testing import NereidTestCase
from pagination import ElasticPagination

config.add_section('elastic_search')
config.set('elastic_search', 'server_uri', 'http://localhost:9200')


class TestPagination(NereidTestCase):
    """
    Test Pagination
    """
    def setUp(self):
        """
        Set up data used in the tests.
        this method is called before each test function execution.
        """
        trytond.tests.test_tryton.install_module(
            'nereid_webshop_elastic_search'
        )
Exemplo n.º 10
0
# -*- coding: utf-8 -*-
import unittest

import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, with_transaction, ModuleTestCase
from trytond.config import config


config.add_section('elastic_search')
config.set('elastic_search', 'server_uri', 'http://localhost:9200')


class IndexBacklogTestCase(ModuleTestCase):
    """
    Tests Index Backlog
    """
    module = 'elastic_search'

    def setUp(self):
        trytond.tests.test_tryton.install_module('elastic_search')
        self.IndexBacklog = POOL.get('elasticsearch.index_backlog')
        self.Configuration = POOL.get('elasticsearch.configuration')
        self.User = POOL.get('res.user')

    @with_transaction()
    def test_0010_create_IndexBacklog(self):
        """
        Creates index backlog and updates remote elastic search index
        """
        self.Configuration(1).save()
        users = self.User.create([{
Exemplo n.º 11
0
 def setUp(self):
     super(LDAPAuthenticationTestCase, self).setUp()
     config.add_section(section)
     config.set(section, 'uri', 'ldap://localhost/dc=tryton,dc=org')