Commit 91f3cb38 authored by Titouan Soulard's avatar Titouan Soulard

slapos_jio_api_style: update calls to _makeComplexComputeNode

parent 9f085453
...@@ -76,6 +76,8 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin): ...@@ -76,6 +76,8 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self.portal_slap = self.portal.portal_slap self.portal_slap = self.portal.portal_slap
self.web_site = self.portal.web_site_module.hostingjs self.web_site = self.portal.web_site_module.hostingjs
self.project = self.addProject()
self._makeTree(self.project)
# Prepare compute_node # Prepare compute_node
self.compute_node = self.portal.compute_node_module.template_compute_node\ self.compute_node = self.portal.compute_node_module.template_compute_node\
...@@ -172,7 +174,7 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin): ...@@ -172,7 +174,7 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin):
class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
def test_01_getFullComputerInformationInstanceList(self): def test_01_getFullComputerInformationInstanceList(self):
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(self.project, with_slave=True)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
instance_1 = self.compute_node.partition1.getAggregateRelatedValue(portal_type='Software Instance') instance_1 = self.compute_node.partition1.getAggregateRelatedValue(portal_type='Software Instance')
...@@ -259,7 +261,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -259,7 +261,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
}, instance_dict) }, instance_dict)
def test_01_bis_getFullComputerInformationSoftwareList(self): def test_01_bis_getFullComputerInformationSoftwareList(self):
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(self.project, with_slave=True)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
...@@ -325,7 +327,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -325,7 +327,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
}, software_dict) }, software_dict)
def test_02_computerBang(self): def test_02_computerBang(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.called_banged_kw = "" self.called_banged_kw = ""
def calledBang(*args, **kw): def calledBang(*args, **kw):
...@@ -356,7 +358,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -356,7 +358,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
xXXX TODO Cedric Make sure we can create and modifiy when using weird url strings xXXX TODO Cedric Make sure we can create and modifiy when using weird url strings
""" """
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
...@@ -418,7 +420,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -418,7 +420,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
self.assertTrue(software_release_uri in error_log.getTextContent()) self.assertTrue(software_release_uri in error_log.getTextContent())
def test_05_destroyedSoftwareRelease_noDestroyRequested(self): def test_05_destroyedSoftwareRelease_noDestroyRequested(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
start_time = DateTime() start_time = DateTime()
software_installation = self.start_requested_software_installation software_installation = self.start_requested_software_installation
...@@ -452,7 +454,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -452,7 +454,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
self.assertTrue(urllib.quote(software_release_uri) in error_log.getTextContent()) self.assertTrue(urllib.quote(software_release_uri) in error_log.getTextContent())
def test_06_destroyedSoftwareRelease_destroyRequested(self): def test_06_destroyedSoftwareRelease_destroyRequested(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
destroy_requested = self.destroy_requested_software_installation destroy_requested = self.destroy_requested_software_installation
self.assertEqual(destroy_requested.getValidationState(), "validated") self.assertEqual(destroy_requested.getValidationState(), "validated")
...@@ -469,7 +471,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -469,7 +471,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
self.assertEqual(destroy_requested.getValidationState(), "invalidated") self.assertEqual(destroy_requested.getValidationState(), "invalidated")
def test_07_availableSoftwareRelease(self): def test_07_availableSoftwareRelease(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
software_installation = self.start_requested_software_installation software_installation = self.start_requested_software_installation
...@@ -503,7 +505,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -503,7 +505,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
self.assertEqual(expected_dict, software_dict) self.assertEqual(expected_dict, software_dict)
def test_08_buildingSoftwareRelease(self): def test_08_buildingSoftwareRelease(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
software_installation = self.start_requested_software_installation software_installation = self.start_requested_software_installation
...@@ -537,7 +539,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -537,7 +539,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
self.assertEqual(expected_dict, software_dict) self.assertEqual(expected_dict, software_dict)
def test_09_softwareReleaseError(self): def test_09_softwareReleaseError(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
software_installation = self.start_requested_software_installation software_installation = self.start_requested_software_installation
...@@ -572,7 +574,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -572,7 +574,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
def test_10_getComputerPartitionCertificate(self): def test_10_getComputerPartitionCertificate(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId()) self.login(self.start_requested_software_instance.getUserId())
certificate_dict = self.getToApi({ certificate_dict = self.getToApi({
...@@ -595,7 +597,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -595,7 +597,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
}) })
def test_11_getFullComputerInformationWithSharedInstance(self, with_slave=True): def test_11_getFullComputerInformationWithSharedInstance(self, with_slave=True):
self._makeComplexComputeNode(with_slave=with_slave) self._makeComplexComputeNode(self.project, with_slave=with_slave)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.login(instance.getUserId()) self.login(instance.getUserId())
...@@ -674,7 +676,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -674,7 +676,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
self.test_11_getFullComputerInformationWithSharedInstance(with_slave=False) self.test_11_getFullComputerInformationWithSharedInstance(with_slave=False)
def test_12_getSharedInstance(self): def test_12_getSharedInstance(self):
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(self.project, with_slave=True)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
# Check Slaves # Check Slaves
...@@ -745,7 +747,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -745,7 +747,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
def test_13_setConnectionXml_withSlave(self): def test_13_setConnectionXml_withSlave(self):
# XXX CLN No idea how to deal with ascii # XXX CLN No idea how to deal with ascii
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(self.project, with_slave=True)
connection_parameters_dict = { connection_parameters_dict = {
"p1e": "v1e", "p1e": "v1e",
"p2e": "v2e", "p2e": "v2e",
...@@ -775,7 +777,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -775,7 +777,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
def test_14_setConnectionXml(self): def test_14_setConnectionXml(self):
# XXX CLN No idea how to deal with ascii # XXX CLN No idea how to deal with ascii
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
connection_parameters_dict = { connection_parameters_dict = {
"p1e": "v1e", "p1e": "v1e",
"p2e": "v2e", "p2e": "v2e",
...@@ -804,7 +806,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -804,7 +806,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
self.start_requested_software_instance.__class__.updateConnection = updateConnection self.start_requested_software_instance.__class__.updateConnection = updateConnection
def test_15_softwareInstanceError(self): def test_15_softwareInstanceError(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.login(instance.getUserId()) self.login(instance.getUserId())
error_log = 'The error' error_log = 'The error'
...@@ -830,7 +832,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -830,7 +832,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
) )
def test_16_softwareInstanceError_twice(self): def test_16_softwareInstanceError_twice(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.login(instance.getUserId()) self.login(instance.getUserId())
error_log = 'The error' error_log = 'The error'
...@@ -876,7 +878,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -876,7 +878,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
) )
def test_17_softwareInstanceBang(self): def test_17_softwareInstanceBang(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.called_instance_bang = "" self.called_instance_bang = ""
...@@ -916,7 +918,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -916,7 +918,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
) )
def test_18_softwareInstanceRename(self): def test_18_softwareInstanceRename(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
new_name = 'new me' new_name = 'new me'
...@@ -947,7 +949,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -947,7 +949,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
instance.__class__.rename = rename instance.__class__.rename = rename
def test_19_destroyedComputePartition(self): def test_19_destroyedComputePartition(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.login(self.destroy_requested_software_instance.getUserId()) self.login(self.destroy_requested_software_instance.getUserId())
self.callInstancePutToApiAndCheck({ self.callInstancePutToApiAndCheck({
"reference": self.destroy_requested_software_instance.getReference(), "reference": self.destroy_requested_software_instance.getReference(),
...@@ -960,7 +962,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -960,7 +962,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
self.assertEqual(None, self.destroy_requested_software_instance.getSslCertificate()) self.assertEqual(None, self.destroy_requested_software_instance.getSslCertificate())
def test_20_request_withSlave(self): def test_20_request_withSlave(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.called_instance_request = "" self.called_instance_request = ""
...@@ -1006,7 +1008,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1006,7 +1008,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
instance.__class__.requestInstance = requestInstance instance.__class__.requestInstance = requestInstance
def test_21_request(self): def test_21_request(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.called_instance_request = "" self.called_instance_request = ""
...@@ -1051,7 +1053,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1051,7 +1053,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
instance.__class__.requestInstance = requestInstance instance.__class__.requestInstance = requestInstance
def test_22_request_stopped(self): def test_22_request_stopped(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.stop_requested_software_instance instance = self.stop_requested_software_instance
self.called_instance_request = "" self.called_instance_request = ""
...@@ -1097,7 +1099,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1097,7 +1099,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
instance.__class__.requestInstance = requestInstance instance.__class__.requestInstance = requestInstance
def test_23_updateInstanceSuccessorList(self): def test_23_updateInstanceSuccessorList(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId()) self.login(self.start_requested_software_instance.getUserId())
...@@ -1141,7 +1143,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1141,7 +1143,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
self.start_requested_software_instance.getSuccessorTitleList()) self.start_requested_software_instance.getSuccessorTitleList())
def test_24_updateInstanceSuccessorList_one_child(self): def test_24_updateInstanceSuccessorList_one_child(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId()) self.login(self.start_requested_software_instance.getUserId())
...@@ -1172,7 +1174,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1172,7 +1174,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
self.start_requested_software_instance.getSuccessorTitleList()) self.start_requested_software_instance.getSuccessorTitleList())
def test_25_updateInstanceSuccessorList_no_child(self): def test_25_updateInstanceSuccessorList_no_child(self):
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId()) self.login(self.start_requested_software_instance.getUserId())
...@@ -1200,7 +1202,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1200,7 +1202,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
def test_26_stoppedComputePartition(self): def test_26_stoppedComputePartition(self):
# XXX Should reported_state added to Instance returned json? # XXX Should reported_state added to Instance returned json?
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.login(instance.getUserId()) self.login(instance.getUserId())
self.callInstancePutToApiAndCheck({ self.callInstancePutToApiAndCheck({
...@@ -1223,7 +1225,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin): ...@@ -1223,7 +1225,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
def test_27_startedComputePartition(self): def test_27_startedComputePartition(self):
# XXX Should reported_state added to Instance returned json? # XXX Should reported_state added to Instance returned json?
self._makeComplexComputeNode() self._makeComplexComputeNode(self.project)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.login(instance.getUserId()) self.login(instance.getUserId())
self.callInstancePutToApiAndCheck({ self.callInstancePutToApiAndCheck({
...@@ -1287,7 +1289,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1287,7 +1289,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
self.compute_node.__class__.reportComputeNodeBang = reportComputeNodeBang self.compute_node.__class__.reportComputeNodeBang = reportComputeNodeBang
def test_31_getInstanceWithSharedInstance(self, with_slave=True): def test_31_getInstanceWithSharedInstance(self, with_slave=True):
self._makeComplexComputeNode(person=self.person, with_slave=with_slave) self._makeComplexComputeNode(self.project, person=self.person, with_slave=with_slave)
self.callUpdateRevisionAndTic() self.callUpdateRevisionAndTic()
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
self.login(self.person_user_id) self.login(self.person_user_id)
...@@ -1336,7 +1338,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1336,7 +1338,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
def test_32_softwareInstanceBang(self): def test_32_softwareInstanceBang(self):
self._makeComplexComputeNode(person=self.person) self._makeComplexComputeNode(self.project, person=self.person)
self.called_instance_bang = "" self.called_instance_bang = ""
def calledBanged(*args, **kw): def calledBanged(*args, **kw):
self.called_instance_bang = kw self.called_instance_bang = kw
...@@ -1376,7 +1378,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1376,7 +1378,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
) )
def test_33_softwareInstanceRename(self): def test_33_softwareInstanceRename(self):
self._makeComplexComputeNode(person=self.person) self._makeComplexComputeNode(self.project, person=self.person)
new_name = 'new me' new_name = 'new me'
self.called_instance_rename = "" self.called_instance_rename = ""
...@@ -1491,7 +1493,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin): ...@@ -1491,7 +1493,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
default_email_coordinate_text="%s@example.org" % self.person.getReference(), default_email_coordinate_text="%s@example.org" % self.person.getReference(),
career_role='member', career_role='member',
) )
self._makeComplexComputeNode(person=self.person) self._makeComplexComputeNode(self.project, person=self.person)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
instance.updateLocalRolesOnSecurityGroups() instance.updateLocalRolesOnSecurityGroups()
self.callUpdateRevision() self.callUpdateRevision()
......
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