Commit 9a0c0f08 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: test: reduce number of alarm calls

parent 9aef8389
......@@ -6,7 +6,6 @@
##############################################################################
from erp5.component.test.SlapOSTestCaseDefaultScenarioMixin import DefaultScenarioMixin
# from DateTime import DateTime
class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
......@@ -144,8 +143,7 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
portal_type="Organisation",
title="test-seller-%s" % self.generateNewId(),
# required to generate accounting report
price_currency_value=currency,
#group='company'
price_currency_value=currency
)
seller_bank_account = seller_organisation.newContent(
portal_type="Bank Account",
......@@ -209,6 +207,17 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
return currency, seller_organisation, seller_bank_account, sale_person
def checkERP5StateBeforeExit(self):
self.logout()
self.stepCallAlarmList()
self.tic()
self.login()
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
def assertRelatedObjectCount(self, document, count):
related_object_list = document.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
related_object_list = [x.getRelativeUrl() for x in related_object_list]
......@@ -333,12 +342,6 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.tic()
# XXX Do this for every scenario tests
self.logout()
for _ in range(3):
self.stepCallAlarmList()
self.tic()
self.login()
# Ensure no unexpected object has been created
# 3 allocation supply, line, cell
......@@ -356,15 +359,11 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 3 subscription request
self.assertRelatedObjectCount(project, 28)
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
self.checkERP5StateBeforeExit()
def test_deposit_with_accounting_scenario(self):
currency, _, _, _ = self.bootstrapVirtualMasterTest()
currency, _, _, _ = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=True)
self.logout()
# lets join as slapos administrator, which will own few compute_nodes
......@@ -397,9 +396,10 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
payment_transaction.PaymentTransaction_acceptDepositPayment()
self.tic()
assert payment_transaction is not None
assert payment_transaction.receivable.getGroupingReference(None) is not None
self.checkERP5StateBeforeExit()
def test_virtual_master_with_accounting_scenario(self):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest()
......@@ -530,12 +530,6 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
public_server_software, public_instance_type,
public_server, project.getReference())
# XXX Do this for every scenario tests
self.logout()
for _ in range(2):
self.stepCallAlarmList()
self.tic()
self.login()
public_person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=public_reference).getParentValue()
......@@ -560,14 +554,6 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.tic()
# XXX Do this for every scenario tests
# XXX Do this for every scenario tests
self.logout()
for _ in range(10):
self.stepCallAlarmList()
self.tic()
self.login()
# Check stock
inventory_list = self.portal.portal_simulation.getCurrentInventoryList(**{
'group_by_section': False,
......@@ -612,11 +598,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 3 subscription requests
self.assertRelatedObjectCount(project, 50)
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
self.checkERP5StateBeforeExit()
def test_virtual_master_slave_without_accounting_scenario(self):
......@@ -750,11 +732,6 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.tic()
# XXX Do this for every scenario tests
self.logout()
self.stepCallAlarmList()
self.tic()
self.login()
# Ensure no unexpected object has been created
# 6 allocation supply/line/cell
......@@ -771,11 +748,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 4 subscription request
self.assertRelatedObjectCount(project, 37)
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
self.checkERP5StateBeforeExit()
def test_virtual_master_slave_on_same_tree_without_accounting_scenario(self):
......@@ -890,11 +863,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 3 subscription request
self.assertRelatedObjectCount(project, 23)
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
self.checkERP5StateBeforeExit()
def test_virtual_master_on_remote_tree_without_accounting_scenario(self):
......@@ -1119,12 +1088,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 2 subscription requests
self.assertRelatedObjectCount(project, 22)
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
self.checkERP5StateBeforeExit()
def test_virtual_master_slave_instance_on_remote_tree_without_accounting_scenario(self):
......@@ -1369,11 +1333,7 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# 2 subscription requests
self.assertRelatedObjectCount(project, 22)
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
self.checkERP5StateBeforeExit()
def test_open_order_with_service_scenario(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment