Commit 71e6b40c authored by Titouan Soulard's avatar Titouan Soulard

slapos_jio_api_style: update API to use project_reference

parent 42c494e2
......@@ -48,7 +48,8 @@ try:
instance_xml=castToStr(partition_parameter),
shared=data_dict.get("shared", False),
sla_xml=castToStr(filter_kw),
state=data_dict.get("state", "started"))
state=data_dict.get("state", "started"),
project_reference=data_dict.get("project_reference"))
if compute_node_id and compute_partition_id:
compute_partition = portal.portal_catalog.getComputePartitionObject(
......
......@@ -975,11 +975,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try:
requestInstance = instance.__class__.requestInstance
project_reference = self.project.getReference()
instance.__class__.requestInstance = calledRequestInstance
partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference()
self.login(instance.getUserId())
response_dict = self.postToApi({
"portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release",
"software_type": "req_type",
"title": "req_reference",
......@@ -994,6 +996,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
"project_reference": project_reference,
'software_title': 'req_reference',
'software_release': 'req_release',
'state': 'started',
......@@ -1021,11 +1024,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try:
requestInstance = instance.__class__.requestInstance
project_reference = self.project.getReference()
instance.__class__.requestInstance = calledRequestInstance
partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference()
self.login(instance.getUserId())
response_dict = self.postToApi({
"portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release",
"software_type": "req_type",
"title": "req_reference",
......@@ -1039,6 +1044,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
"project_reference": project_reference,
'software_title': 'req_reference',
'software_release': 'req_release',
'shared': False,
......@@ -1066,11 +1072,13 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
try:
requestInstance = instance.__class__.requestInstance
project_reference = self.project.getReference()
instance.__class__.requestInstance = calledRequestInstance
partition_id = instance.getAggregateValue(portal_type='Compute Partition').getReference()
self.login(instance.getUserId())
response_dict = self.postToApi({
"portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release",
"software_type": "req_type",
"title": "req_reference",
......@@ -1085,6 +1093,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
"project_reference": project_reference,
'software_title': 'req_reference',
'software_release': 'req_release',
'shared': False,
......@@ -1409,10 +1418,12 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
try:
requestSoftwareInstance = self.person.__class__.requestSoftwareInstance
project_reference = self.project.getReference()
self.person.__class__.requestSoftwareInstance = calledRequestInstance
self.login(self.person_user_id)
response_dict = self.postToApi({
"portal_type": "Software Instance",
"project_reference": project_reference,
"software_release_uri": "req_release",
"software_type": "req_type",
"title": "req_reference",
......@@ -1425,6 +1436,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
'project_reference': project_reference,
'software_title': 'req_reference',
'software_release': 'req_release',
'state': 'started',
......@@ -1449,6 +1461,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
try:
requestSoftwareInstance = self.person.__class__.requestSoftwareInstance
project_reference = self.project.getReference()
self.person.__class__.requestSoftwareInstance = calledRequestInstance
self.login(self.person_user_id)
response_dict = self.postToApi({
......@@ -1456,6 +1469,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
"software_release_uri": "req_release",
"software_type": "req_type",
"title": "req_reference",
"project_reference": project_reference
})
response = self.portal.REQUEST.RESPONSE
if 400 != response.getStatus():
......@@ -1464,6 +1478,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
response.headers.get('content-type'))
self.assertEqual(self.called_instance_request, {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
'project_reference': project_reference,
'software_title': 'req_reference',
'software_release': 'req_release',
'state': 'started',
......@@ -1498,6 +1513,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJIOAPIMixin):
"software_release_uri": instance.getUrlString(),
"software_type": instance.getSourceReference(),
"title": instance.getTitle(),
"project_reference": self.project.getReference()
})
response = self.portal.REQUEST.RESPONSE
......
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