Commit 6bf33b62 authored by Łukasz Nowak's avatar Łukasz Nowak

Mark when objects are manually created by tests.

This will allow to be sure globally, that production code is generating
correct documents.
parent 34de8860
...@@ -257,6 +257,10 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -257,6 +257,10 @@ class testVifibMixin(ERP5TypeTestCase):
if isTransitionPossible(assignment, 'open'): if isTransitionPossible(assignment, 'open'):
assignment.open() assignment.open()
def markManualCreation(self, document):
self.portal.portal_workflow.doActionFor(document, 'edit_action',
comment='Manually created by test.')
def prepareVifibAccountingPeriod(self): def prepareVifibAccountingPeriod(self):
vifib = self.portal.organisation_module['vifib_internet'] vifib = self.portal.organisation_module['vifib_internet']
year = DateTime().year() year = DateTime().year()
...@@ -274,6 +278,7 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -274,6 +278,7 @@ class testVifibMixin(ERP5TypeTestCase):
if accounting_period is None: if accounting_period is None:
accounting_period = vifib.newContent(portal_type='Accounting Period', accounting_period = vifib.newContent(portal_type='Accounting Period',
start_date=start_date, stop_date=stop_date) start_date=start_date, stop_date=stop_date)
self.markManualCreation(accounting_period)
accounting_period.start() accounting_period.start()
def setupVifibMachineAuthenticationPlugin(self): def setupVifibMachineAuthenticationPlugin(self):
......
...@@ -87,6 +87,7 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin): ...@@ -87,6 +87,7 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin):
career_role='internal', career_role='internal',
# password='hackme', # password='hackme',
) )
self.markManualCreation(person)
if user_name != 'manager': if user_name != 'manager':
self.assertTrue(user.has_permission('Access contents information', self.assertTrue(user.has_permission('Access contents information',
person)) person))
...@@ -107,6 +108,7 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin): ...@@ -107,6 +108,7 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin):
start_date = '01/01/1900', start_date = '01/01/1900',
stop_date = '01/01/2900', stop_date = '01/01/2900',
) )
self.markManualCreation(assignment)
if user_name != 'manager': if user_name != 'manager':
self.assertTrue(user.has_permission('Access contents information', self.assertTrue(user.has_permission('Access contents information',
assignment)) assignment))
......
...@@ -43,6 +43,7 @@ class TestVifibFiberSubscription(testVifibSecurityMixin): ...@@ -43,6 +43,7 @@ class TestVifibFiberSubscription(testVifibSecurityMixin):
module = self.portal.getDefaultModule("Organisation") module = self.portal.getDefaultModule("Organisation")
organisation = module.newContent(portal_type="Organisation", organisation = module.newContent(portal_type="Organisation",
reference="vifib-support") reference="vifib-support")
self.markManualCreation(organisation)
organisation.validate() organisation.validate()
#Install website #Install website
......
...@@ -740,6 +740,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -740,6 +740,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
reference=computer_reference, reference=computer_reference,
destination_reference=computer_reference, destination_reference=computer_reference,
) )
self.markManualCreation(computer)
return computer, computer_reference return computer, computer_reference
def stepCreateDraftComputer(self, sequence, **kw): def stepCreateDraftComputer(self, sequence, **kw):
...@@ -1573,6 +1574,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1573,6 +1574,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
service = module.newContent( service = module.newContent(
portal_type=self.service_portal_type, portal_type=self.service_portal_type,
title="A custom accounting service") title="A custom accounting service")
self.markManualCreation(service)
service.validate() service.validate()
sequence.edit(service_uid=service.getUid()) sequence.edit(service_uid=service.getUid())
...@@ -1660,6 +1662,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1660,6 +1662,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_partition = computer.newContent( computer_partition = computer.newContent(
portal_type=self.computer_partition_portal_type, portal_type=self.computer_partition_portal_type,
reference=partition_reference) reference=partition_reference)
self.markManualCreation(computer_partition)
# Mark newly created computer partition as free by default # Mark newly created computer partition as free by default
computer_partition.markFree() computer_partition.markFree()
sequence.edit(computer_partition_uid=computer_partition.getUid()) sequence.edit(computer_partition_uid=computer_partition.getUid())
...@@ -1744,6 +1747,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1744,6 +1747,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type=self.software_product_portal_type, portal_type=self.software_product_portal_type,
title=title, title=title,
) )
self.markManualCreation(software_product)
sequence.edit(software_product_uid=software_product.getUid()) sequence.edit(software_product_uid=software_product.getUid())
def stepValidateSoftwareProduct(self, sequence, **kw): def stepValidateSoftwareProduct(self, sequence, **kw):
...@@ -1770,6 +1774,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1770,6 +1774,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
reference=url, reference=url,
contributor_value=self.portal.person_module.test_vifib_user_developer, contributor_value=self.portal.person_module.test_vifib_user_developer,
url_string=url) url_string=url)
self.markManualCreation(software_release)
sequence.edit(software_release_uid=software_release.getUid()) sequence.edit(software_release_uid=software_release.getUid())
def stepCheckUnexistingSoftwareRelease(self, sequence, **kw): def stepCheckUnexistingSoftwareRelease(self, sequence, **kw):
...@@ -2525,6 +2530,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2525,6 +2530,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
destination_decision='person_module/test_vifib_customer', destination_decision='person_module/test_vifib_customer',
price_currency='currency_module/EUR', price_currency='currency_module/EUR',
) )
self.markManualCreation(order)
sequence.edit(purchase_packing_list_uid=order.getUid()) sequence.edit(purchase_packing_list_uid=order.getUid())
def stepCreatePurchasePackingListLine(self, sequence, **kw): def stepCreatePurchasePackingListLine(self, sequence, **kw):
...@@ -2536,6 +2542,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2536,6 +2542,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
line = order.newContent( line = order.newContent(
portal_type=self.purchase_packing_list_line_portal_type, portal_type=self.purchase_packing_list_line_portal_type,
quantity=1) quantity=1)
self.markManualCreation(line)
sequence.edit(purchase_packing_list_line_uid=line.getUid()) sequence.edit(purchase_packing_list_line_uid=line.getUid())
def stepSetPurchasePackingListLineAggregate(self, sequence, **kw): def stepSetPurchasePackingListLineAggregate(self, sequence, **kw):
...@@ -2945,6 +2952,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2945,6 +2952,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
price_currency='currency_module/EUR', price_currency='currency_module/EUR',
start_date=DateTime(), start_date=DateTime(),
) )
self.markManualCreation(order)
sequence.edit(sale_packing_list_uid=order.getUid()) sequence.edit(sale_packing_list_uid=order.getUid())
def stepCreateSalePackingListLine(self, sequence, **kw): def stepCreateSalePackingListLine(self, sequence, **kw):
...@@ -2958,6 +2966,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2958,6 +2966,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
quantity=1, quantity=1,
price=1 price=1
) )
self.markManualCreation(line)
sequence.edit(sale_packing_list_line_uid=line.getUid()) sequence.edit(sale_packing_list_line_uid=line.getUid())
def stepSetSalePackingListLineSetupResource(self, sequence, **kw): def stepSetSalePackingListLineSetupResource(self, sequence, **kw):
......
...@@ -10,6 +10,7 @@ class TestVifibSoftwareInstance(testVifibMixin): ...@@ -10,6 +10,7 @@ class TestVifibSoftwareInstance(testVifibMixin):
def _test_si_tree(self): def _test_si_tree(self):
software_instance = self.portal.software_instance_module.newContent( software_instance = self.portal.software_instance_module.newContent(
portal_type='Software Instance') portal_type='Software Instance')
self.markManualCreation(software_instance)
self.checkConnected = software_instance.checkConnected self.checkConnected = software_instance.checkConnected
self.checkNotCyclic = software_instance.checkNotCyclic self.checkNotCyclic = software_instance.checkNotCyclic
......
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