Commit 2dbf4008 authored by Titouan Soulard's avatar Titouan Soulard Committed by Romain Courteaud

slapos_jio_api_style: update Person creation in tests

parent 4534a1a8
......@@ -76,22 +76,26 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self)
self.portal_slap = self.portal.portal_slap
self.web_site = self.portal.web_site_module.hostingjs
# Create project and person
if getattr(self, "project", None) is None:
self.project = self.addProject()
self._makeTree(self.project)
self.person = self.makePerson(self.project)
self.addProjectProductionManagerAssignment(self.person, self.project)
self.commit()
# Prepare compute_node
self.compute_node = self.portal.compute_node_module.template_compute_node\
.Base_createCloneDocument(batch_mode=1)
self.compute_node.edit(
title="Compute Node %s" % self.new_id,
reference="TESTCOMP-%s" % self.new_id
)
if getattr(self, "person", None) is not None:
self.compute_node.edit(
source_administration_value=getattr(self, "person", None),
reference="TESTCOMP-%s" % self.new_id,
follow_up_value=self.project
)
self.compute_node.validate()
# Make compute node access
self._addERP5Login(self.compute_node)
self.tic()
......@@ -1248,21 +1252,11 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
def afterSetUp(self):
password = "%s-1Aa$" % self.generateNewId()
reference = 'test_%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
title=reference,
reference=reference)
person.newContent(portal_type='Assignment', role='member').open()
person.newContent(portal_type='ERP5 Login',
reference=reference, password=password).validate()
self.commit()
self.person = person
self.person_reference = person.getReference()
self.person_user_id = person.getUserId()
TestSlapOSJIOAPIMixin.afterSetUp(self)
self.person_reference = self.person.getReference()
self.person_user_id = self.person.getUserId()
def test_30_computerBang(self):
self.called_banged_kw = ""
def calledBang(*args, **kw):
......
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