[FIX] event: Make tests demo data independent
Part-of: odoo/odoo#146649
This commit is contained in:
@@ -16,6 +16,10 @@ class TestMailSchedule(EventCase, MockEmail):
|
||||
@mute_logger('odoo.addons.base.models.ir_model', 'odoo.models')
|
||||
def test_event_mail_schedule(self):
|
||||
""" Test mail scheduling for events """
|
||||
self.env.company.write({
|
||||
'name': 'YourCompany',
|
||||
'email': 'info@yourcompany.example.com',
|
||||
})
|
||||
event_cron_id = self.env.ref('event.event_mail_scheduler')
|
||||
|
||||
# deactivate other schedulers to avoid messing with crons
|
||||
|
||||
@@ -11,6 +11,10 @@ class TestEventBoothSaleCommon(TestEventBoothCommon):
|
||||
def setUpClass(cls):
|
||||
super(TestEventBoothSaleCommon, cls).setUpClass()
|
||||
|
||||
cls.env['account.tax.group'].create(
|
||||
{'name': 'Test Account Tax Group', 'company_id': cls.env.company.id}
|
||||
)
|
||||
|
||||
cls.event_booth_product = cls.env['product.product'].create({
|
||||
'name': 'Test Booth Product',
|
||||
'description_sale': 'Mighty Booth Description',
|
||||
|
||||
@@ -6,6 +6,7 @@ from datetime import datetime, timedelta
|
||||
from odoo import Command, fields
|
||||
from odoo.addons.event_booth_sale.tests.common import TestEventBoothSaleCommon
|
||||
from odoo.addons.sales_team.tests.common import TestSalesCommon
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests.common import tagged, users
|
||||
from odoo.tools import float_compare
|
||||
|
||||
@@ -114,11 +115,11 @@ class TestEventBoothSale(TestEventBoothSaleWData):
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestEventBoothSaleInvoice(TestEventBoothSaleWData):
|
||||
class TestEventBoothSaleInvoice(AccountTestInvoicingCommon, TestEventBoothSaleWData):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestEventBoothSaleInvoice, cls).setUpClass()
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
|
||||
# Add group `group_account_invoice` to user_sales_salesman to allow to pay the invoice
|
||||
cls.user_sales_salesman.groups_id += cls.env.ref('account.group_account_invoice')
|
||||
|
||||
@@ -23,7 +23,7 @@ registry.category("web_tour.tours").add('event_configurator_tour', {
|
||||
actions.text('Event Registration');
|
||||
}
|
||||
}, {
|
||||
trigger: 'ul.ui-autocomplete a:contains("Event")',
|
||||
trigger: 'ul.ui-autocomplete a:contains("Event Registration")',
|
||||
run: 'click'
|
||||
}, {
|
||||
trigger: 'div[name="event_id"] input',
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestEventSale(TestEventSaleCommon):
|
||||
})
|
||||
|
||||
cls.sale_order = cls.env['sale.order'].create({
|
||||
'partner_id': cls.env.ref('base.res_partner_2').id,
|
||||
'partner_id': cls.env['res.partner'].create({'name': 'Test Partner'}).id,
|
||||
'note': 'Invoice after delivery',
|
||||
'payment_term_id': cls.env.ref('account.account_payment_term_end_following_month').id
|
||||
})
|
||||
@@ -69,6 +69,10 @@ class TestEventSale(TestEventSaleCommon):
|
||||
'partner_id': cls.event_customer.id,
|
||||
})
|
||||
|
||||
cls.env['account.tax.group'].create(
|
||||
{'name': 'Test Account Tax Group', 'company_id': cls.env.company.id}
|
||||
)
|
||||
|
||||
@users('user_sales_salesman')
|
||||
def test_event_crm_sale(self):
|
||||
TICKET1_COUNT, TICKET2_COUNT = 3, 1
|
||||
|
||||
@@ -11,6 +11,7 @@ from odoo.addons.test_event_full.tests.common import TestWEventCommon
|
||||
class TestWEventRegister(TestWEventCommon):
|
||||
|
||||
def test_register(self):
|
||||
self.env.company.country_id = self.env.ref('base.us')
|
||||
with freeze_time(self.reference_now, tick=True):
|
||||
self.start_tour('/event', 'wevent_register', login=None)
|
||||
new_registrations = self.event.registration_ids
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import datetime, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import fields
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserDemo
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserDemo, HttpCaseWithUserPortal
|
||||
from odoo.addons.mail.tests.common import mail_new_test_user
|
||||
from odoo.addons.website.tests.test_base_url import TestUrlCommon
|
||||
from odoo.addons.website_event.tests.common import OnlineEventCase
|
||||
@@ -15,7 +15,7 @@ from odoo.tools import mute_logger
|
||||
from odoo.tests.common import users
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestUi(HttpCaseWithUserDemo):
|
||||
class TestUi(HttpCaseWithUserDemo, HttpCaseWithUserPortal):
|
||||
|
||||
def test_website_event_tour_admin(self):
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'website_event_tour', login='admin', step_delay=100)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserDemo, HttpCaseWithUserPortal
|
||||
from odoo.tests import tagged
|
||||
|
||||
@@ -19,4 +21,32 @@ class TestWEventBoothExhibitorCommon(HttpCaseWithUserDemo, HttpCaseWithUserPorta
|
||||
})
|
||||
transfer_provider._transfer_ensure_pending_msg_is_set()
|
||||
|
||||
self.env.ref('base.user_admin').write({
|
||||
'name': 'Mitchell Admin',
|
||||
'street': '215 Vine St',
|
||||
'phone': '+1 555-555-5555',
|
||||
'city': 'Scranton',
|
||||
'zip': '18503',
|
||||
'country_id': self.env.ref('base.us').id,
|
||||
'state_id': self.env.ref('base.state_us_39').id,
|
||||
})
|
||||
|
||||
self.env['event.event'].create({
|
||||
'name': 'Test Online Reveal',
|
||||
'date_tz': 'Europe/Brussels',
|
||||
'stage_id': self.env.ref('event.event_stage_booked').id,
|
||||
'date_begin': datetime.now() + relativedelta(days=1, hour=5, minute=0, second=0),
|
||||
'date_end': datetime.now() + relativedelta(days=1, hour=5, minute=0, second=0),
|
||||
'is_published': True,
|
||||
'website_menu': True,
|
||||
'booth_menu': True,
|
||||
'exhibitor_menu': True,
|
||||
'event_booth_ids': [(0, 0, {
|
||||
'name': 'Standard Booth',
|
||||
'booth_category_id': self.env.ref('event_booth.event_booth_category_standard').id,
|
||||
}), (0, 0, {
|
||||
'name': 'OpenWood Demonstrator 2',
|
||||
'booth_category_id': self.env.ref('event_booth.event_booth_category_premium').id,
|
||||
})]
|
||||
})
|
||||
self.start_tour('/event', 'webooth_exhibitor_register', login='admin')
|
||||
|
||||
@@ -5,13 +5,13 @@ from datetime import datetime, timedelta
|
||||
|
||||
from odoo import Command, fields
|
||||
from odoo.addons.website_event_sale.tests.common import TestWebsiteEventSaleCommon
|
||||
from odoo.tests import HttpCase
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserPortal
|
||||
from odoo.tests.common import tagged
|
||||
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestWebsiteEventBoothSale(HttpCase, TestWebsiteEventSaleCommon):
|
||||
class TestWebsiteEventBoothSale(HttpCaseWithUserPortal, TestWebsiteEventSaleCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@@ -64,7 +64,24 @@ class TestWebsiteEventBoothSale(HttpCase, TestWebsiteEventSaleCommon):
|
||||
|
||||
def test_tour(self):
|
||||
self.env['product.pricelist'].sudo().search([]).action_archive()
|
||||
self.partner_portal.write({
|
||||
'street': '858 Lynn Street',
|
||||
'city': 'Bayonne',
|
||||
'country_id': self.env.ref('base.state_us_25').id,
|
||||
'zip': '07002',
|
||||
'phone': '(683)-556-5104',
|
||||
})
|
||||
self.start_tour('/event', 'website_event_booth_tour', login='portal')
|
||||
|
||||
def test_booth_pricelists_different_currencies(self):
|
||||
self.env.ref('base.user_admin').partner_id.write({
|
||||
'email': 'mitchell.stephen@example.com',
|
||||
'name': 'Mitchell Admin',
|
||||
'street': '215 Vine St',
|
||||
'city': 'Scranton',
|
||||
'zip': '18503',
|
||||
'country_id': self.env.ref('base.us').id,
|
||||
'state_id': self.env.ref('base.state_us_39').id,
|
||||
'phone': '+1 555-555-5555',
|
||||
})
|
||||
self.start_tour("/web", 'event_booth_sale_pricelists_different_currencies', login='admin')
|
||||
|
||||
@@ -13,6 +13,7 @@ class TestWebsiteEventSaleCommon(TransactionCase):
|
||||
def setUpClass(cls):
|
||||
super(TestWebsiteEventSaleCommon, cls).setUpClass()
|
||||
|
||||
cls.env.company.country_id = cls.env.ref('base.us')
|
||||
cls.currency_test = cls.env['res.currency'].create({
|
||||
'name': 'eventX',
|
||||
'rounding': 0.01,
|
||||
|
||||
Reference in New Issue
Block a user