コード例 #1
0
    def setUpClass(cls):
        super(TestStaticFile, cls).setUpClass()

        testing_proxy.install_module('nereid')  # Install module

        with Transaction().start(testing_proxy.db_name, 1, None) as txn:
            company = testing_proxy.create_company('Test Company')
            testing_proxy.set_company_for_user(1, company)

            cls.guest_user = testing_proxy.create_guest_user(company=company)

            cls.site = testing_proxy.create_site(
                'localhost',
                application_user = 1, guest_user = cls.guest_user
            )

            # Create a homepage template
            testing_proxy.create_template(
                'home.jinja',
                '''
                {% set static_file = static_file_obj.browse(static_file_id) %}
                {{ static_file.url }}
                ''', cls.site
            )

            txn.cursor.commit()
コード例 #2
0
    def setUpClass(cls):
        super(TestAddress, cls).setUpClass()
        testing_proxy.install_module('nereid')

        country_obj = testing_proxy.pool.get('country.country')

        with Transaction().start(testing_proxy.db_name, 1, None) as txn:
            company = testing_proxy.create_company('Test Company')
            testing_proxy.set_company_for_user(1, company)

            cls.guest_user = testing_proxy.create_guest_user(company=company)
            cls.regd_user_id = testing_proxy.create_user_party(
                'Registered User', '*****@*****.**', 'password', company
            )

            cls.available_countries = country_obj.search([], limit=5)
            cls.site = testing_proxy.create_site(
                'localhost',
                countries = [('set', cls.available_countries)],
                application_user = 1, guest_user = cls.guest_user
                )

            testing_proxy.create_template(
                'home.jinja',
                '{{get_flashed_messages()}}', cls.site)
            testing_proxy.create_template(
                'login.jinja',
                '{{ login_form.errors }} {{get_flashed_messages()}}', cls.site)
            testing_proxy.create_template(
                'registration.jinja',
                '{{ form.errors }} {{get_flashed_messages()}}', cls.site)

            testing_proxy.create_template(
                'reset-password.jinja', '', cls.site)
            testing_proxy.create_template(
                'change-password.jinja',
                '{{ change_password_form.errors }}', cls.site)
            testing_proxy.create_template(
                'address-edit.jinja',
                'Address Edit {{ form.errors }}', cls.site)
            testing_proxy.create_template(
                'address.jinja', '', cls.site)
            testing_proxy.create_template(
                'account.jinja', '', cls.site)
            # Create templates for activation emails
            testing_proxy.create_template(
                'emails/activation-text.jinja', '', cls.site
            )
            testing_proxy.create_template(
                'emails/activation-html.jinja', '', cls.site
            )
            testing_proxy.create_template(
                'emails/reset-text.jinja', '', cls.site
            )
            testing_proxy.create_template(
                'emails/reset-html.jinja', '', cls.site
            )
            txn.cursor.commit()
コード例 #3
0
ファイル: test_i18n.py プロジェクト: shalabhaggarwal/nereid
    def setUpClass(cls):
        super(TestI18N, cls).setUpClass()
        testing_proxy.install_module('nereid')

        with Transaction().start(testing_proxy.db_name, 1, None) as txn:
            company = testing_proxy.create_company('Test Company')
            testing_proxy.set_company_for_user(1, company)

            cls.guest_user = testing_proxy.create_guest_user(company=company)

            txn.cursor.commit()
コード例 #4
0
    def setUpClass(cls):
        super(TestLinkedInAuth, cls).setUpClass()
        # Install module
        testing_proxy.install_module('nereid_auth_linkedin')

        with Transaction().start(testing_proxy.db_name, 1, None) as txn:
            country_obj = Pool().get('country.country')
            currency_obj = Pool().get('currency.currency')

            company = testing_proxy.create_company('Test Company')
            testing_proxy.set_company_for_user(1, company)

            cls.guest_user = testing_proxy.create_guest_user(company=company)
            cls.regd_user_id = testing_proxy.create_user_party(
                'Registered User', '*****@*****.**', 'password', company
            )

            cls.available_countries = country_obj.search([], limit=5)
            cls.available_currencies = currency_obj.search([
                ('code', '=', 'USD')
            ])

            cls.site = testing_proxy.create_site(
                'localhost',
                countries = [('set', cls.available_countries)],
                currencies = [('set', cls.available_currencies)],
                application_user = 1,
                guest_user = cls.guest_user,
            )

            testing_proxy.create_template(
                'home.jinja', '{{ get_flashed_messages() }}', cls.site
            )
            testing_proxy.create_template(
                'login.jinja',
                '{{ login_form.errors }} {{ get_flashed_messages() }}',
                cls.site
            )
            txn.cursor.commit()
コード例 #5
0
    def setUpClass(cls):
        # Install module
        testing_proxy.install_module("nereid_payment")

        with Transaction().start(testing_proxy.db_name, 1, None) as txn:
            uom_obj = Pool().get("product.uom")
            journal_obj = Pool().get("account.journal")
            country_obj = Pool().get("country.country")
            currency_obj = Pool().get("currency.currency")

            # Create company
            cls.company = testing_proxy.create_company("Test Company")
            testing_proxy.set_company_for_user(1, cls.company)
            # Create Fiscal Year
            fiscal_year = testing_proxy.create_fiscal_year(company=cls.company)
            # Create Chart of Accounts
            testing_proxy.create_coa_minimal(cls.company)
            # Create payment term
            testing_proxy.create_payment_term()

            cls.guest_user = testing_proxy.create_guest_user(company=cls.company)

            category_template = testing_proxy.create_template("category-list.jinja", " ")
            product_template = testing_proxy.create_template("product-list.jinja", " ")
            cls.available_countries = country_obj.search([], limit=5)
            cls.available_currencies = currency_obj.search([("code", "=", "USD")])
            cls.site = testing_proxy.create_site(
                "localhost",
                category_template=category_template,
                product_template=product_template,
                countries=[("set", cls.available_countries)],
                currencies=[("set", cls.available_currencies)],
                guest_user=cls.guest_user,
            )

            testing_proxy.create_template("home.jinja", " Home ", cls.site)
            testing_proxy.create_template("checkout.jinja", "{{form.errors}}", cls.site)
            testing_proxy.create_template("login.jinja", "{{ login_form.errors }} {{get_flashed_messages()}}", cls.site)
            testing_proxy.create_template(
                "shopping-cart.jinja",
                "Cart:{{ cart.id }},{{get_cart_size()|round|int}},{{cart.sale.total_amount}}",
                cls.site,
            )

            category = testing_proxy.create_product_category("Category", uri="category")
            stock_journal = journal_obj.search([("code", "=", "STO")])[0]
            cls.product = testing_proxy.create_product(
                "product 1",
                category,
                type="goods",
                # purchasable = True,
                salable=True,
                list_price=Decimal("10"),
                cost_price=Decimal("5"),
                account_expense=testing_proxy.get_account_by_kind("expense"),
                account_revenue=testing_proxy.get_account_by_kind("revenue"),
                uri="product-1",
                sale_uom=uom_obj.search([("name", "=", "Unit")], limit=1)[0],
                # account_journal_stock_input = stock_journal,
                # account_journal_stock_output = stock_journal,
            )

            txn.cursor.commit()
コード例 #6
0
    def setUpClass(cls):
        super(TestCheckout, cls).setUpClass()

        testing_proxy.install_module('nereid_checkout')

        with Transaction().start(testing_proxy.db_name, 1, None) as txn:
            uom_obj = Pool().get('product.uom')
            journal_obj = Pool().get('account.journal')
            country_obj = Pool().get('country.country')
            currency_obj = Pool().get('currency.currency')
            location_obj = Pool().get('stock.location')

            # Create company
            cls.company = testing_proxy.create_company('Test Company')
            testing_proxy.set_company_for_user(1, cls.company)
            # Create Fiscal Year
            fiscal_year = testing_proxy.create_fiscal_year(company=cls.company)
            # Create Chart of Accounts
            testing_proxy.create_coa_minimal(cls.company)
            # Create payment term
            testing_proxy.create_payment_term()

            cls.guest_user = testing_proxy.create_guest_user(company=cls.company)

            cls.available_countries = country_obj.search([], limit=5)
            cls.available_currencies = currency_obj.search([('code', '=', 'USD')])
            location, = location_obj.search([
                ('type', '=', 'storage')
            ], limit=1)
            warehouse, = location_obj.search([
                ('type', '=', 'warehouse')
            ], limit=1)
            cls.site = testing_proxy.create_site(
                'localhost', 
                countries = [('set', cls.available_countries)],
                currencies = [('set', cls.available_currencies)],
                application_user = 1, guest_user = cls.guest_user,
                stock_location = location,
                warehouse=warehouse,
            )

            testing_proxy.create_template('home.jinja', ' Home ', cls.site)
            testing_proxy.create_template('checkout.jinja', 
                '{{form.errors|safe}}', cls.site)
            testing_proxy.create_template(
                'login.jinja', 
                '{{ login_form.errors }} {{get_flashed_messages()}}', cls.site)
            testing_proxy.create_template('shopping-cart.jinja', 
                'Cart:{{ cart.id }},{{get_cart_size()|round|int}},{{cart.sale.total_amount}}', 
                cls.site)
            product_template = testing_proxy.create_template(
                'product.jinja', ' ', cls.site)
            category_template = testing_proxy.create_template(
                'category.jinja', ' ', cls.site)

            testing_proxy.create_template(
                'emails/sale-confirmation-text.jinja', ' ', cls.site)
            testing_proxy.create_template(
                'emails/sale-confirmation-html.jinja', ' ', cls.site)

            category = testing_proxy.create_product_category(
                'Category', uri='category')
            stock_journal = journal_obj.search([('code', '=', 'STO')])[0]
            cls.product = testing_proxy.create_product(
                'product 1', category,
                type = 'goods',
                salable = True,
                list_price = Decimal('10'),
                cost_price = Decimal('5'),
                account_expense = testing_proxy.get_account_by_kind('expense'),
                account_revenue = testing_proxy.get_account_by_kind('revenue'),
                uri = 'product-1',
                sale_uom = uom_obj.search([('name', '=', 'Unit')], limit=1)[0],
                )

            txn.cursor.commit()