Commit 0e1b755c authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: need a project assignment to create a compute node

parent 1c2ba903
......@@ -11,14 +11,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
......@@ -34,14 +53,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)
......@@ -214,7 +233,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)
......@@ -222,14 +241,14 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.setServerOpenPublic(public_server)
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.assertNotEqual(None, personal_server)
self.setServerOpenPersonal(personal_server)
friend_server_title = 'Friend Server for %s' % owner_reference
friend_server_id = self.requestComputeNode(friend_server_title)
friend_server_id = self.requestComputeNode(friend_server_title, 'XXX')
friend_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=friend_server_id)
self.assertNotEqual(None, friend_server)
......
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