From c27a7ac5f96250c13c65ca335510d220accdc452 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Fri, 6 Jan 2023 13:57:12 +0000
Subject: [PATCH] slapos_cloud: project needed in test

---
 ...lapOSCloudInstanceSlapInterfaceWorkflow.py | 24 ++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py b/master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
index fb19f26f1..6cea2f321 100644
--- a/master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
+++ b/master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
@@ -31,6 +31,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
     SlapOSTestCaseMixin.afterSetUp(self)
     portal = self.getPortalObject()
     new_id = self.generateNewId()
+    self.project = self.addProject()
 
     self.request_kw = dict(
         software_release=self.generateNewSoftwareReleaseUrl(),
@@ -39,7 +40,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
         instance_xml=self.generateSafeXml(),
         sla_xml=self.generateSafeXml(),
         shared=False,
-        state="started"
+        state="started",
+        project_reference=self.project.getReference()
     )
 
     # prepare part of tree
@@ -56,7 +58,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
         text_content=self.request_kw['instance_xml'],
         sla_xml=self.request_kw['sla_xml'],
         root_slave=self.request_kw['shared'],
-        successor=self.software_instance.getRelativeUrl()
+        successor=self.software_instance.getRelativeUrl(),
+        follow_up_value=self.project
     )
     instance_tree.validate()
     self.portal.portal_workflow._jumpToStateFor(instance_tree, 'start_requested')
@@ -68,7 +71,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
         source_reference=self.request_kw['software_type'],
         text_content=self.request_kw['instance_xml'],
         sla_xml=self.request_kw['sla_xml'],
-        specialise=instance_tree.getRelativeUrl()
+        specialise=instance_tree.getRelativeUrl(),
+        follow_up_value=self.project
     )
     self.portal.portal_workflow._jumpToStateFor(self.software_instance, 'start_requested')
     self.software_instance.validate()
@@ -870,6 +874,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
     SlapOSTestCaseMixin.afterSetUp(self)
     portal = self.getPortalObject()
     new_id = self.generateNewId()
+    self.project = self.addProject()
 
     self.request_kw = dict(
         software_release=self.generateNewSoftwareReleaseUrl(),
@@ -878,7 +883,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
         instance_xml=self.generateSafeXml(),
         sla_xml=self.generateSafeXml(),
         shared=False,
-        state="started"
+        state="started",
+        project_reference=self.project.getReference()
     )
 
     # prepare part of tree
@@ -895,7 +901,8 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
         text_content=self.request_kw['instance_xml'],
         sla_xml=self.request_kw['sla_xml'],
         root_slave=self.request_kw['shared'],
-        successor=self.software_instance.getRelativeUrl()
+        successor=self.software_instance.getRelativeUrl(),
+        follow_up_value=self.project
     )
     self.instance_tree.validate()
     self.portal.portal_workflow._jumpToStateFor(self.instance_tree, 'start_requested')
@@ -907,13 +914,14 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
         source_reference=self.request_kw['software_type'],
         text_content=self.request_kw['instance_xml'],
         sla_xml=self.request_kw['sla_xml'],
-        specialise=self.instance_tree.getRelativeUrl()
+        specialise=self.instance_tree.getRelativeUrl(),
+        follow_up_value=self.project
     )
     self.portal.portal_workflow._jumpToStateFor(self.software_instance, 'start_requested')
     self.software_instance.validate()
     self.tic()
 
-    person_user = self.makePerson()
+    person_user = self.makePerson(self.project)
     self.tic()
 
     # Login as new user
@@ -956,7 +964,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
       destination_project=None)
 
     self.login()
-    other_user = self.makePerson(user=1)
+    other_user = self.makePerson(self.project, user=1)
     self.assertEqual(1 , len(other_user.objectValues(portal_type="ERP5 Login")))
 
     self.instance_tree.setDestinationSectionValue(destination_section)
-- 
2.30.9