Commit e45ad93e authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: need a project assignment to create a compute node

parent 01c39f90
......@@ -25,14 +25,33 @@ import re
class TestSlapOSDefaultScenario(DefaultScenarioMixin):
"""
def addSlapOSAdministratorAssignment(self, person):
person.newContent(
portal_type='Assignment',
# XXX should be project/function instead
group='company'
).open()
"""
def addProjectComputeNodeManagerAssignment(self, person, project):
person.newContent(
portal_type='Assignment',
destination_project_value=project,
function='computer/manager'
).open()
def addProject(self):
project = self.portal.project_module.newContent(
portal_type='Project',
title='project-%s' % self.generateNewId()
)
project.validate()
return project
def test_new_default_scenario(self):
# create a default project
project = self.addProject()
# some preparation
self.logout()
self.web_site = self.portal.web_site_module.hostingjs
......@@ -48,14 +67,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addSlapOSAdministratorAssignment(owner_person)
self.addProjectComputeNodeManagerAssignment(owner_person, project)
self.tic()
# hooray, now it is time to create compute_nodes
self.login(owner_person.getUserId())
public_server_title = 'Public Server for %s' % owner_reference
public_server_id = self.requestComputeNode(public_server_title)
public_server_id = self.requestComputeNode(public_server_title, project.getReference())
public_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server)
......@@ -228,7 +247,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.login(owner_person.getUserId())
public_server_title = 'Public Server for %s' % owner_reference
public_server_id = self.requestComputeNode(public_server_title)
public_server_id = self.requestComputeNode(public_server_title, 'XXX')
public_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server)
......@@ -237,7 +256,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
public_server.generateCertificate()
personal_server_title = 'Personal Server for %s' % owner_reference
personal_server_id = self.requestComputeNode(personal_server_title)
personal_server_id = self.requestComputeNode(personal_server_title, 'XXX')
personal_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=personal_server_id)
self.setAccessToMemcached(personal_server)
......@@ -736,4 +755,4 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
self.tic()
# check final document state
self.assertPersonDocumentCoverage(person)
\ No newline at end of file
self.assertPersonDocumentCoverage(person)
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