Commit 9e304f98 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud:

* fixup test
* test compute network sla
* Computer Network creation requires a project reference
parent 806d0d57
......@@ -621,6 +621,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
type_variation = software_product.contentValues(portal_type='Software Product Type Variation')[0]
self.tic()
partition = None
if node == "compute":
person.requestComputeNode(compute_node_title='test compute node',
project_reference=project.getReference())
......
......@@ -8,20 +8,32 @@ kwargs = state_change.kwargs
try:
computer_network_title = kwargs['network_title']
except KeyError:
raise TypeError, "Person_requestNetwork takes exactly 1 argument"
raise TypeError, "Person_requestNetwork takes exactly 2 arguments. Missing network_title."
tag = "%s_%s_NetworkInProgress" % (person.getUid(),
try:
project_reference = kwargs['project_reference']
except KeyError:
raise TypeError, "Person_requestNetwork takes exactly 2 arguments. Missing project_reference."
tag = "%s_%s_NetworkInProgress" % (person.getUid(),
computer_network_title)
if (portal.portal_activities.countMessageWithTag(tag) > 0):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise NotImplementedError(tag)
# Ensure project is correctly set
project_list = portal.portal_catalog.portal_catalog(portal_type='Project', reference=project_reference,
validation_state='validated', limit=2)
if len(project_list) != 1:
raise NotImplementedError("%i projects '%s'" % (len(project_list), project_reference))
computer_network_portal_type = "Computer Network"
computer_network_list = portal.portal_catalog.portal_catalog(
portal_type=computer_network_portal_type,
title=computer_network_title,
validation_state="validated",
follow_up__uid=project_list[0].getUid(),
#validation_state="validated",
limit=2)
if len(computer_network_list) == 2:
......@@ -35,6 +47,7 @@ else:
portal_type=computer_network_portal_type,
title=computer_network_title,
source_administration=person.getRelativeUrl(),
follow_up_value=project_list[0],
activate_kw={'tag': tag}
)
context.REQUEST.set("computer_network_relative_url", computer_network.getRelativeUrl())
......
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