Commit 78ca9e68 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: add customer project assignment

parent 5694a8fd
...@@ -26,6 +26,13 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -26,6 +26,13 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
function='computer/manager' function='computer/manager'
).open() ).open()
def addProjectCustomerAssignment(self, person, project):
person.newContent(
portal_type='Assignment',
destination_project_value=project,
function='customer'
).open()
def addProject(self): def addProject(self):
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project', portal_type='Project',
...@@ -83,13 +90,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -83,13 +90,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
public_person = self.portal.portal_catalog.getResultValue( public_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=public_reference).getParentValue() reference=public_reference).getParentValue()
self.addProjectCustomerAssignment(public_person, project)
public_instance_title = 'Public title %s' % self.generateNewId() public_instance_title = 'Public title %s' % self.generateNewId()
public_instance_type = 'public type' public_instance_type = 'public type'
self.checkInstanceAllocation(public_person.getUserId(), self.checkInstanceAllocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server_software, public_instance_type,
public_server) public_server, project.getReference())
# turn public guy to a friend and check that he can allocate slave # turn public guy to a friend and check that he can allocate slave
...@@ -103,7 +111,8 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -103,7 +111,8 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
# and the instances # and the instances
self.checkInstanceUnallocation(public_person.getUserId(), self.checkInstanceUnallocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server) public_server_software, public_instance_type, public_server,
project.getReference())
# and uninstall some software on them # and uninstall some software on them
self.logout() self.logout()
...@@ -120,6 +129,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -120,6 +129,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm() self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm()
self.tic() self.tic()
self.logout()
self.login() self.login()
self.assertOpenSaleOrderCoverage(public_reference) self.assertOpenSaleOrderCoverage(public_reference)
...@@ -204,16 +214,23 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -204,16 +214,23 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm() self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic() self.tic()
"""
self.logout()
self.login('ERP5TypeTestCase')
# trigger the CRM interaction # trigger the CRM interaction
self.stepCallSlaposCrmCreateRegularisationRequestAlarm() self.stepCallSlaposCrmCreateRegularisationRequestAlarm()
self.tic() self.tic()
self.logout()
self.login()
# check final document state # check final document state
for person_reference in (owner_reference, ): for person_reference in (owner_reference, ):
person = self.portal.portal_catalog.getResultValue( person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=person_reference).getParentValue() portal_type='ERP5 Login', reference=person_reference).getParentValue()
self.assertPersonDocumentCoverage(person) self.assertPersonDocumentCoverage(person)
"""
def test_default_scenario(self): def test_default_scenario(self):
# some preparation # some preparation
...@@ -286,7 +303,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -286,7 +303,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.checkInstanceAllocation(public_person.getUserId(), self.checkInstanceAllocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server_software, public_instance_type,
public_server) public_server, 'XXX')
# join as owner friend and request a software instance on compute_node # join as owner friend and request a software instance on compute_node
# configured by owner # configured by owner
...@@ -307,7 +324,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -307,7 +324,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
friend_instance_type = 'friend_type' friend_instance_type = 'friend_type'
self.checkInstanceAllocation(friend_person.getUserId(), friend_reference, self.checkInstanceAllocation(friend_person.getUserId(), friend_reference,
friend_instance_title, friend_server_software, friend_instance_type, friend_instance_title, friend_server_software, friend_instance_type,
friend_server) friend_server, 'XXX')
# check that friend is able to request slave instance matching the # check that friend is able to request slave instance matching the
# public's compute_node software instance # public's compute_node software instance
...@@ -315,7 +332,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -315,7 +332,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
generateNewId() generateNewId()
self.checkSlaveInstanceAllocation(friend_person.getUserId(), self.checkSlaveInstanceAllocation(friend_person.getUserId(),
friend_reference, friend_slave_instance_title, public_server_software, friend_reference, friend_slave_instance_title, public_server_software,
public_instance_type, public_server) public_instance_type, public_server, 'XXX')
# turn public guy to a friend and check that he can allocate slave # turn public guy to a friend and check that he can allocate slave
# instance on instance provided by friend # instance on instance provided by friend
...@@ -331,25 +348,25 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -331,25 +348,25 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
.generateNewId() .generateNewId()
self.checkSlaveInstanceAllocation(public_person.getUserId(), self.checkSlaveInstanceAllocation(public_person.getUserId(),
public_reference, public_slave_instance_title, friend_server_software, public_reference, public_slave_instance_title, friend_server_software,
friend_instance_type, friend_server) friend_instance_type, friend_server, 'XXX')
# now deallocate the slaves # now deallocate the slaves
self.checkSlaveInstanceUnallocation(public_person.getUserId(), self.checkSlaveInstanceUnallocation(public_person.getUserId(),
public_reference, public_slave_instance_title, friend_server_software, public_reference, public_slave_instance_title, friend_server_software,
friend_instance_type, friend_server) friend_instance_type, friend_server, 'XXX')
self.checkSlaveInstanceUnallocation(friend_person.getUserId(), self.checkSlaveInstanceUnallocation(friend_person.getUserId(),
friend_reference, friend_slave_instance_title, public_server_software, friend_reference, friend_slave_instance_title, public_server_software,
public_instance_type, public_server) public_instance_type, public_server, 'XXX')
# and the instances # and the instances
self.checkInstanceUnallocation(public_person.getUserId(), self.checkInstanceUnallocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server) public_server_software, public_instance_type, public_server, 'XXX')
self.checkInstanceUnallocation(friend_person.getUserId(), self.checkInstanceUnallocation(friend_person.getUserId(),
friend_reference, friend_instance_title, friend_reference, friend_instance_title,
friend_server_software, friend_instance_type, friend_server) friend_server_software, friend_instance_type, friend_server, 'XXX')
# and uninstall some software on them # and uninstall some software on them
self.logout() self.logout()
...@@ -605,7 +622,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin): ...@@ -605,7 +622,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
public_instance_type = 'public type' public_instance_type = 'public type'
public_server_software = self.generateNewSoftwareReleaseUrl() public_server_software = self.generateNewSoftwareReleaseUrl()
self.requestInstance(person.getUserId(), public_instance_title, self.requestInstance(person.getUserId(), public_instance_title,
public_server_software, public_instance_type) public_server_software, public_instance_type, 'XXX')
# check the Open Sale Order coverage # check the Open Sale Order coverage
self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm() self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm()
......
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSERP5DefaultScenario</string> </value> <value> <string>testSlapOSERP5DefaultScenario</string> </value>
...@@ -55,28 +49,13 @@ ...@@ -55,28 +49,13 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -89,7 +68,7 @@ ...@@ -89,7 +68,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -98,7 +77,7 @@ ...@@ -98,7 +77,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
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