Commit c37a5bc3 authored by Romain Courteaud's avatar Romain Courteaud

slapos_slap_tool: _makeComplexComputeNode need a project

parent b6e6fdc4
......@@ -45,6 +45,8 @@ class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self)
self.portal_slap = self.portal.portal_slap
self.project = self.addProject()
# Prepare compute_node
self.compute_node = self.portal.compute_node_module.template_compute_node\
.Base_createCloneDocument(batch_mode=1)
......@@ -73,7 +75,7 @@ class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
def test_activate_getFullComputerInformation_first_access(self):
self._makeComplexComputeNode(with_slave=True)
self._makeComplexComputeNode(self.project, with_slave=True)
self.portal.REQUEST['disable_isTestRun'] = True
self.login(self.compute_node_user_id)
......@@ -243,7 +245,7 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
def test_getFullComputerInformation(self):
self._makeComplexComputeNode(with_slave=True)
self._makeComplexComputeNode(self.project, with_slave=True)
partition_1_root_instance_title = self.compute_node.partition1.getAggregateRelatedValue(
portal_type='Software Instance').getSpecialiseValue().getTitle()
......@@ -734,7 +736,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
'recmethod': 'reportComputeNodeBang'}])
def test_computerBang(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.compute_node_bang_simulator = tempfile.mkstemp()[1]
try:
self.login(self.compute_node_user_id)
......@@ -786,7 +788,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
os.unlink(self.compute_node_load_configuration_simulator)
def test_not_accessed_getSoftwareInstallationStatus(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.compute_node_bang_simulator = tempfile.mkstemp()[1]
self.login(self.compute_node_user_id)
created_at = rfc1123_date(DateTime())
......@@ -845,7 +847,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
"http://example.org/foo", self.compute_node_id)
def test_destroyedSoftwareRelease_noDestroyRequested(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.login(self.compute_node_user_id)
self.assertRaises(NotFound,
self.portal_slap.destroyedSoftwareRelease,
......@@ -853,7 +855,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
self.compute_node_id)
def test_destroyedSoftwareRelease_destroyRequested(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.login(self.compute_node_user_id)
destroy_requested = self.destroy_requested_software_installation
self.assertEqual(destroy_requested.getValidationState(), "validated")
......@@ -862,7 +864,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
self.assertEqual(destroy_requested.getValidationState(), "invalidated")
def test_availableSoftwareRelease(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.compute_node_bang_simulator = tempfile.mkstemp()[1]
self.login(self.compute_node_user_id)
software_installation = self.start_requested_software_installation
......@@ -912,7 +914,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_buildingSoftwareRelease(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.compute_node_bang_simulator = tempfile.mkstemp()[1]
self.login(self.compute_node_user_id)
software_installation = self.start_requested_software_installation
......@@ -962,7 +964,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_softwareReleaseError(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.compute_node_bang_simulator = tempfile.mkstemp()[1]
self.login(self.compute_node_user_id)
software_installation = self.start_requested_software_installation
......@@ -1116,7 +1118,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
def test_getComputerPartitionCertificate(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -1151,7 +1153,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getFullComputerInformation(self):
self._makeComplexComputeNode(with_slave=True)
self._makeComplexComputeNode(self.project, with_slave=True)
self.login(self.start_requested_software_instance.getUserId())
response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.assertEqual(200, response.status)
......@@ -1293,7 +1295,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
created_at = rfc1123_date(DateTime())
......@@ -1343,7 +1345,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus_visited(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
created_at = rfc1123_date(DateTime())
......@@ -1396,7 +1398,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition_withSlave(self):
self._makeComplexComputeNode(with_slave=True)
self._makeComplexComputeNode(self.project, with_slave=True)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -1527,7 +1529,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -1647,7 +1649,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'recmethod': 'updateConnection'}])
def test_setConnectionXml_withSlave(self):
self._makeComplexComputeNode(with_slave=True)
self._makeComplexComputeNode(self.project, with_slave=True)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
slave_reference = self.start_requested_slave_instance.getReference()
......@@ -1681,7 +1683,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_update_connection_simulator)
def test_setConnectionXml(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
connection_xml = """<marshal>
......@@ -1714,7 +1716,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_update_connection_simulator)
def test_softwareInstanceError(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -1762,7 +1764,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_softwareInstanceError_twice(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -1868,7 +1870,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'recmethod': 'bang'}])
def test_softwareInstanceBang(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.instance_bang_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -1931,7 +1933,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'recmethod': 'rename'}])
def test_softwareInstanceRename(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.instance_rename_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -1951,7 +1953,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_rename_simulator)
def test_destroyedComputePartition(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.destroy_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
ssl_key = self.destroy_requested_software_instance.getSslKey()
......@@ -1979,7 +1981,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'recmethod': 'requestInstance'}])
def test_request_withSlave(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -2014,7 +2016,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_request_simulator)
def test_request(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -2049,7 +2051,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_request_simulator)
def test_request_stopped(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.stop_requested_software_instance.getAggregateValue(
......@@ -2084,7 +2086,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_request_simulator)
def test_updateInstanceSuccessorList(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
......@@ -2136,7 +2138,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
self.start_requested_software_instance.getSuccessorTitleList())
def test_updateInstanceSuccessorList_one_child(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
......@@ -2169,7 +2171,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
self.start_requested_software_instance.getSuccessorTitleList())
def test_updateInstanceSuccessorList_no_child(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
......@@ -2201,7 +2203,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
self.start_requested_software_instance.getSuccessorTitleList())
def test_stoppedComputePartition(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -2248,7 +2250,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_startedComputePartition(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.start_requested_software_instance.getUserId())
......@@ -2601,7 +2603,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
os.unlink(self.compute_node_bang_simulator)
def test_getComputerPartitionStatus(self):
self._makeComplexComputeNode()
self._makeComplexComputeNode(self.project)
self.login(self.person_user_id)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
......@@ -2652,7 +2654,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus_visited(self):
self._makeComplexComputeNode(person=self.person)
self._makeComplexComputeNode(self.project, person=self.person)
self.login(self.person_user_id)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
......@@ -2707,7 +2709,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition_withSlave(self):
self._makeComplexComputeNode(person=self.person, with_slave=True)
self._makeComplexComputeNode(self.project, person=self.person, with_slave=True)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.person_user_id)
......@@ -2838,7 +2840,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition(self):
self._makeComplexComputeNode(person=self.person)
self._makeComplexComputeNode(self.project, person=self.person)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Compute Partition').getReference()
self.login(self.person_user_id)
......@@ -2958,7 +2960,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'bang'}])
def test_softwareInstanceBang(self):
self._makeComplexComputeNode(person=self.person)
self._makeComplexComputeNode(self.project, person=self.person)
self.instance_bang_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -3023,7 +3025,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'rename'}])
def test_softwareInstanceRename(self):
self._makeComplexComputeNode(person=self.person)
self._makeComplexComputeNode(self.project, person=self.person)
self.instance_rename_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -3115,7 +3117,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
default_email_coordinate_text="%s@example.org" % self.person.getReference(),
career_role='member',
)
self._makeComplexComputeNode(person=self.person)
self._makeComplexComputeNode(self.project, person=self.person)
self.start_requested_software_instance.updateLocalRolesOnSecurityGroups()
self.tic()
self.login(self.person_user_id)
......
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